I have developed an application where i am inserting all the records from the dataset into sql mobile 2005. Dataset contains a primary key which is an uniqueidentifier datatype. While inserting the data it is inserting properly into the database but it is changing the value of primary key which is in the dataset.
I am using the below syntax, please suggest me so that to avoid creating a different uniqueidentier key into the database.
conAdap = new SqlCeDataAdapter(strQuery, conSqlceConnection);
SqlCeCommandBuilder cmdBuilder = new SqlCeCommandBuilder(conAdap);
I have developed an application in c#.net 2.0 for Pocket PC. And even i developed a webservice to communicate between sql server 2005 and sql mobile 2005. Webservice returns the data in a dataset format from sql server 2005, but while inserting the data row by row from dataset, it is taking a huge amount of time. I would like to know, is there any way where i can copy the bulk data from dataset into the sql mobile 2005 using c#.And how this can be achieved.
D2 is a list of data. each row in D2 has a classid. D2 may or may not have all the classids in D1. all classids in D2 must be in D1.
I want to show fields in D2 and group the data with classids in D1 and show every group as a seperate table. If no data in D2 is available for a classid, It shows a empty table.
I have a database running in an instance of SQL Server.
I set this up for merge publication and then set up a SQL Server Mobile Edition Subscription to that publication. After a few oversights I got everything working. The Mobile database replicated just fine. I went back verified all data was there. Can make queries to it.
PROBLEM:
I set up a new dataset to use tables from the SQL Server Mobile database. If I drag one of the tables to the dataset, VS 2005 simply stops responding. It is not using any processor. I click any place on the application and I get the Microsoft Visual Studio Delay Notification saying:
Microsoft Visual Studio is Busy.
Microsoft Visual Studio is waiting for an internal operation to complete. If you regularly encounter this delay during normal usage, please report this problem to Microsoft.
Well... It is more than just a delay. The environment is not using any processor its just sitting here. And I left it running for 2.5 hours... so now this is becoming a big source of pain for me because I need to get that dataset working to finish my business logic. The only option I have is to Kill the process.
Hopefully someone out there can help.
Additional Services running:
IIS (Whatever version comes with Windows XP Pro. I think 5.1)
SQL Server Agent, SQL Server Integration Services, SQL Server Broswer and SQL Server FullTextSearch
UPDATE: I am editing this post with an update.
I noticed that my other tables get added to the dataset just fine. It is when I add one particular table that the entire visual studio simply stops and starts giving the delay notification. I have no idea why this happens... nor do I see any noticeable difference between this table and the rest of them. I went back and made sure that all columns types where directly supported by SQL Mobile Edition and they are.
Hi there, I'm using CF2.0 SP1, with sqlce. I have a 5MB delimitered file with 60,000 rows. I need to insert it into a table in the PDA. Once I start the procedure that inserts the table, the PDA's memory drops by 20-30 MB and every once in a while i get a "Out OfMemory" exception...
Basically I send an insert command for every row in the text file cause last time i've checked, multiple rows insert per call wasn't yet implemented in the Sql Mobile... Correct me if i'm wrong...
Code Block
StreamReader sr = new StreamReader(file, System.Text.Encoding.GetEncoding(1255)); line = sr.ReadLine(); clsAceProduct ace = new clsAceProduct(); //Read the first line of text //Continue to read until you reach end of file while (line != null) { //Send the Insert SQL Command ace.Fill(line.Split(x)); bInsert=InsertAceProduct(ace); if (bInsert) { l++; } //Read the next line line = sr.ReadLine();
Am having an issue using a dataset returned from a web service method. The webservice grabs data from a desktop SQL server database and returns it as a dataset.
I can call the web service fine and load the dataset into a datagrid (testing purposes). etc
However am having an issue with inserting the dataset data into the Windows CE Database.
Web Service Method
<WebMethod(Description:="Query a database. Returns a dataset.")> _ Public Function GetData(ByVal connectionString As String, ByVal selectcommand As String) As DataSet Dim ds As DataSet = New DataSet() Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection() Dim Command As SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand() Dim DataAdapter As SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter()
ds = x.GetData("Data Source=Stephen01;Initial Catalog=BoxDB; uid=ste;pwd=1234;", "Select * from Swipes")
Try For Each dr As DataRow In ds.Tables(0).Rows db.Update("INSERT INTO Swipes (CardNo,Jobcode,ClockedAt,ClockType) VALUES(" & dr.Item(0) & "," & dr.Item(1) & "," & dr.Item(2) & ",'" & dr.Item(3) & "')") Next
db.Close() Catch ex As Exception MsgBox(ex.ToString) End Try(All Values are int's except Dr.item(3) which is a datetime field)
The when i click this button i get the error.
"Data Conversion Failed. [OLE DB status value (if known) = 2]"
I am guessing this is an issue to do with the date but to be perfectly honest i have no idea. Wish CE errors were more indepth!
Gurus, I have two list boxes, user can move items back n forth, from second listbox I am inserting values into a table. So far everything is working fine. Now I want to delete all the existing values from the table before inserting evertime..Please help me in this I dont know what to do. thanks kalloo
I'm trying to checking my production table table_a against a working table table_b (which i'm downlading data to)Here are the collumns i have in table_a and table_bDescription | FundID (this is not my PK) | Money I'm running an update if there is already vaule in the money collumn. I check to see if table_a matches table_b...if not i update table a with table b's value where FundID match up.What i'm having trouble on is if there is no record in table_a but there is a record in table_b. How can I insert that record into table_a? I would like to do all of this (the update and insert statement in one stored proc. if possible. )If anyone has this answer please let me know.Thanks,RB
string fileName = "d:\shiporder.xml"; DataSet dataSet = new DataSet(); dataSet.ReadXML(fileName); //connection string string cmd = "INSERT INTO Orders (OrderID, OrderPerson) VALUES (dataSet.Tables[0].Row[0][0].ToString(),dataSet.Tables[0].Row[0][1].ToString); SqlConnection con = new SqlConnection(conection string); SqlCommand mycmd = new SqlCommand(cmd,con); con.Open(); mycmd.ExecuteNonQuery(); con.Close(); it gives me this error dataSet.Tables its not permitted in this context. valid expression are constants, constant expression, . Columns name are not permitted
I would like to get in the textbox all the cutomer name seperated by ",".
Is the same as I can use join(Parameters!CustomersName.Value,",") but I need to do that from the data set and not from the parameters since I don't have parameters for my customer name
I have this case where I need to multiply the value of my dataset and finally deduce one to it. For instance if I have a dataset with three values, 2, 5, 15, I need to end up with a value of 150 (2*5*15). How can I achieve this?
In sql-server2000 In a table i am having a column of datatype varchar(8000). While inserting the record through executenonquery, i am insert only 255 characters rest of the characters are getting trucated.
My question in how i will able to insert the row of that particular column more than 255 characters
I have a strongly typed dataset, and I need to be able to do a search on multiple values of a parameter. The problem is I don't know how many. I have a textbox that the user can enter search words in. The select string is built from the string of words that are entered, like this:For iCount = 0 To UBound(sArray) strSQL = strSQL & "Description LIKE '%" & sArray(iCount) & "%' OR "Next Can I do this is a dataset method? How? If I can't, what are my options?Diane
I have an ssrs (report builder) with 2 dataset. the first dataset is a summary if records which the report has a column name qty and i put also a total qty summary in the last rows. the second dataset is a raw data and have a column name qty, also i put a total qty summary in the last row. The requirements is to be able to evaluate or check the total qty under dataset1 from total qty of dataset2 if equal else if not equal i have to make the font as red so that the user will inform that the total qty has a discrepancy. the users will validate from raw data which are the one items that have a missing qty. How to work on this or is this appilcable in report builder.
I am mapping an entity from SQL 2005 to another entity in another system on SQL 2000. Since the destination system has its own ID generator, I want to keep the generated ID for each row of my table in a column of my table in SQL 2005. The new column is in the dataset now , but I don't know how to update my table to have that column values (The OleDbDestination just insert new items.)
Hi All, I have written a stored procedure that has a return value (OUTPUT Parameter) and was wondering if there is any way to retreive this value in SQL Server Reporting Services 2005? I get the result fine, but cannot figure out how to get the return parameter.
Hi all,I have a table called Jobs, with fields PK auto increment job_id, job_name, date. I'm using the visual web developer, .net 2.0, sql server 2005.I'm trying to have an option in one of my forms that allows me to add Jobs for a specific time frame. Say I want to add a job called "JobOne" and that I expect this job to last 2 months, so I would like to add this "JobOne" from October 1st 2006 to December 1st 2006. Than in the table "jobs" I would see JobOne in October 1st, 2nd, 3rd... all the way to December 1st. I'm familiar how to insert single values from formviews, using sqldatasources but I have no idea how to insert something like this, so I was wondering if anyone out there could help.Thanks!
Hi there I have an exel spreadsheet with a very long list of towns. How can I import/insert that into my "Towns" table in sql express? I can't seem to find any way to import it and I'm not sure how to do multiple inserts. Thanks
What would be the best way to insert unique values into a table/unique column ? I cannot make that table/unique column as indentity. Right now, I use a staging table with indentity column, insert rows then insert rows back to final table.
I am trying to insert null values into sql server from my access from. I am using sql statement. But it says 'Syntex error in Insert statement'. When i remove null values it works fine? How can I insert null values into a table?
I have a stored procedure "spDetailsByDay" which takes parameters @StartDateTime as datetime, @Day as int, @Hour as int, @Value1 as varchar(20), @value2 as varchar(20)
My report Parameters are StartDateTime as DateTime, Day as integer, Hour as integer, Value1 as string, Value2 as string, ReportType as string
C# .Net Application as front end Sql Server2000 as back end
I need to merge an external dataset from .Net app(in XML format) with the information in database with one column in database table as the merging criteria. A situation similar to Left Outer Join, wherein i need all records from external dataset and if matched in database the corresponding values from there too, the only difference here is that the join is not between two Tables its between a table and external dataset. There is no need to store the external dataset in the database in persistent form, its just a query - merge - response operation.
So, can anyone suggest the best possible solution for this? A table variable / temporary table / some other schema, what and how?
I am using RDLC report with Microsoft visual studio 2005. In the first page of rdlc i have two text boxes and one table in body section. In the second and subsequent pages i want to repeat the data from textbox1 and textbox2 along with table data continuation of page1.
Currently the continuation of table data from page1 to page2 is working properly. But the textbox1 and textbox2 data also needs to be repeated in every pages.
I tried the following steps, but fails to work.
1. added two text boxes in header section and another two text boxes in Body section.
2. Assigns the dataset value to textboxes in body section.
(Ex: =first(Fields!Address.Value)
3. Assigns the textboxes value from Body section to the corresponding text boxes in header section.
(Ex : =first(ReportItems!textbox1.Value))
Result:
The header text box value displayed in the first page only and not repeated in the subsequent pages.
Expected:
Whatever assigned to the header section should be repeated in the subsequent pages. But only page number, date... is reflecting in other pages and not the text box values in header section.
In my report, I need to display column names (and its values) from my dataset, which uses the stored procedure and within it use the PIVOT statement. I cannot use the matrix control in report since I need to add another static column to the right of the matrix, but since that cannot be done ni SQL SSRS 2005, I need to PIVOT it through stored procedure. The parameter passed to stored procedure is the year and it is used for pivot. The statement looks like this:
@sql = 'SELECT * FROM (SELECT YearId, SchoolId, ReportText, OutputValue_Text from AggregateTable) AS AGAM PIVOT (MIN(OutputValue_Text) FOR YearId IN ([' + @YearId + '])) PVT'
EXEC(@sql)
So, since the years passed as parameters can change, I cannot hard-code it as column in my report, so I need to programatically display column names and values from my dataset, something like dataSet.Tables[0].Columns[].ColumnName; I have tried with writing the code, but I do not have much experience with it and I have not been very successful. Can someone help me with the code?
I need to insert some values into a table and after that catch the ID inserted. I set some input parameters in stored procedure and only one to get the @id defined as output SqlParameter paramIdPedido = new SqlParameter("@APP_IDPEDIDO", SqlDbType.Int, 4);paramIdPedido.Direction = ParameterDirection.Output;cmd.Parameters.Add(paramIdPedido); Do I have to run cmd.ExecuteNonQuery(); to record first what I need and afterrun ExecuteReader: something like SqlDataReader dr = cmd.ExecuteReader();while (dr.Read()... to get the ID) From stored procedure: INSERT table(fields) VALUES(vars)SELECT TOP 1 @id = id FROM table ORDER BY id DESC I must do all these steps or maybe is there anything less complex to do? Thanks!
Hi, I am trying to insert multiple values from another table as well as an addition value defined by me. Here's my code which is obviously incorrect at the AND statement: Insert Into table_1 (ID, Col_1, Col_2)Select ID, Col_A, Col_B From table_A AND table1.Col_3 = 'XYZ' Where table_A.Col_A IS NOT NULL
Pls advise on the correct way of constructing this statement. Many Thanks
Hi all, I am having issue with a set of radiobuttons. I have four radiobuttons associated by a groupname (answer). I am attempting to store the text of the selected radiobutton when the user make a selection and clicks submit. For reasons unknown... each of the radiobutton.checked values are remaining false hence I cannot interrogate for a checked equal true to insert associated text of check response. Here is how I am interrogating who is checked: If rb1.Checked = True Then useranswer = rb1.Text.ToString ElseIf rb2.Checked = True Then useranswer = rb2.Text.ToString ElseIf rb3.Checked = True Then useranswer = rb3.Text.ToString ElseIf rb4.Checked = True Then useranswer = rb4.Text.ToString End If I then attempt to insert this text to sql but none of the rb values are true hence a null wont insert. Cmd1.Parameters.Add(New SqlParameter("@answer", useranswer))
How can I evaluate grouped radiobutton checked values? Many thanks in advance... Scott
Hi All, am new to sql server in my application I am having one Asp.net web page, the user has to enter values for 5 fields(Empno,Empname,salary,deptno,deptname) in that web page and for that i created two tables in sql serverEmp Table- empno(primary key),empname,salaryDept Table- Deptno(primary key),empno(Foreign key ),Deptname(with some check constraint.) After the user enter all the values in the Asp.net web page now i want to store data into database for that i wrote the following stored procedure...create procedure usp_EmpDept @empno integer, @empname varchar(15), @salary money, @deptno integer, @deptname varchar(10) As Insert into emp(empno,empname,salary)values(@empno,@empname,@salary) Insert into dept(deptno,Empno,deptname)values(@deptno,@empno,@deptname) but the problem is whenever some constaint violation for eg. if some check constraint violation in Dept table its inserting the values in the Emp table only, but my requirement is, It must enter into both tables if there is no constaraint violation otherwise it has to ignore both the tables. And also please suggest is there any better way to insert values into two tables other than using the stored procedure Any help will be greatly appreciated..Thanks,Vision..
i have a table whose Primary Key is "UserID". the sample "UserID" are M1,M2,M3,M4,B1,B2,B3 . i want that when i insert a valuse "M4" in the table ,by pressing Submit Button. it should not be at the end or at the start of table. Rather it should be next to M3. like the following M1 M2 M3 M4 M5 B1 B2 B3 i need the C# code of how to do that !!!! Thanks
Is there a way to insert multiple values into a single column based on various "tests". For example, I want to check a sales_order table and flag all new orders coming in against previous orders placed that were determined to be fraudulent. If I were to set up i.e. five different tests(i.e. check email, credit_card number etc. against previous fraud orders), then there would be the possibility that any given order can be flagged 1 to 5 times. I want to record all of these tests within the same column if possible. Therefore the output may look something like the following:
order_number fraud_score 1234567890 a,b,d 5432109876 e 2345678901 null 3455607983 a,b,c,d,e
I was considering adding five additional columns to the table and running five different update steps, but this doesn't appear very scalable. Any suggestions would be greatly appreciated! thanks in advance- trevorb