I have a trigger on a view that handles update operations. When I use the MS Management Studio and do an insert I get this error:
Msg 50000, Level 16, State 10, Procedure Trigger_TempTableAttr_Lot_UpdateDelete, Line 166
Violation of UNIQUE KEY constraint 'UK_Lot_LotAccountCode'. Cannot insert duplicate key in object 'app.Lot'.
Msg 3616,...
When updating a DataTable with 1850-ish new rows to a FbDataAdapter I get a NullReferenceException during execution.
Usually it succeeds in inserting around 1200 records, sometimes more, sometimes less...
However when stepping through the code with the debugger, it sometimes inserts the entire recordset, no problem.
I am using the Fir...
Hi All
I have loaded three tables to my application. After the work is done, I want to save it all.
Using 'for each' (is there a better way?), I recreated from my different class objects three data tables.
Now I have the tables, I think I added them to new ds
DataSet ds= new DataSet();
ds.Tables.Add(emp);
ds.Tables.Add(managers);
ds.Ta...
Hi all,
.NET/MSSQL Server Question:
I use a System.Data.SqlClient.SqlDataAdapter to connect to a database and read (.Fill) a datatable from a view in the database (select * from v_coolview).
The problem is that the view consists of multiple tables (of course) and the resulting DataTable has typically a primary key set (Datatable.Primar...
I'm new to vb.net and having quite a challenge with updating a field in a table using the For...Next construct on a data set. Sample code below - can anyone tell me what I'm missing? I know this particular example could be accomplished with a simple SQL update statement, but the actual use for what this code will become requires steppi...
Hi,
I am new to ADO.NET and learning it.
I was wondering if Data Adapter in ADO.NET provides atomicity or ACID properties by itself when filling the Data Set and updating the Database
or do we have to use transaction explicitly to achieve this.
Lets say,
I want to fetch data from the
Database through the Data Adapter to
a Data Set
Se...
Hello,
What is the best method for saving thousands of rows and after doing something, updating them.
Currently, I use a datatable, filling it, when done inserting by
MyDataAdapter.Update(MyDataTable)
After doing some change on MyDataTable, I again use MyDataAdapter.Update(MyDataTable) method.
Edit:
I am sorry for not providing m...
Hi,
I've got a sql stored proc that is working fine in SSMS. When I try and execute through code and assign the return to a dataset I am getting zero rows back. I've used the immediate window to ensure that I am sending the correct params to the stored proc and that is all good.
What else would cause me to get zero rows assigned to th...
I'm having some trouble updating changes I made to a datatable via a dataadapter. I am getting "Concurrency violation: the UpdateCommand affected 0 of 10 rows"
'Get data
Dim Docs_DistributedTable As New DataTable("Docs_Distributed")
Dim sql = "SELECT DISTINCT CompanyID, SortKey, OutputFileID, SequenceNo, DeliveredDate, IsDeliveryCodeCou...
This is a simple question, but I'm having trouble finding the answer.
I have a large datatable of which I have updated many, but not all rows.
I am using a dataadapter to update these changes to SQL server.
Does the dataadapter send update queries only for the updated rows from the datatable, or does it send one for every row, and esc...
Hello Everyone ! Please help me with the following set of code:
Dim daTest as New SqlDataAdapter
Dim dsTest as New DataSet
Dim cbTest as SqlCommandBuilder
Dim dRowTest as DataRow
Dim conx as New SqlConnection(conxString)
conx.Open()
daTest.SelectCommand = New SqlCommand("Select * From Table1", conx)
cbTest = New SqlCommandBuilder(daT...
Is it possible in C# to use an OleDbAdapter and use its Update method for a dataset when a table has no primary key and how can I do this?
...
Hi, short question:
Refering to http://stackoverflow.com/questions/170455/how-can-i-read-multiple-tables-into-a-dataset#answer-366402
My App has a db factory. Can i use 'da.Fill(ds)' [with IDataAdapter implementation] for multiple tables? Or how can i add more tables to the same DataSet. Copy the whole table would work but is this the o...
I'm trying to detect a new row in the database with a dataadapter, so I can trigger some events. It would be easy if I could use a timer(but I can't)
...
Yesterday My colleague told me that using data adapter to insert data into an sql server database is not reliable, because it does not guarantee that data are inserted properly. He also told me that if the data insertion is unsuccessful, it does not show any kind of error message.
I am really confused. I thought microsoft invented ado.n...
This is a small portion of my code file. Each time my debugger reaches the line 'NewDA.Fill(NewDS);' at runtime it jumps to the catch. I'm positive the daynumber variable gets a value that's present in the database and I've tried the query outside of the codefile on my database and it works fine. I'm also using the connectionstring 'db' ...
TableAdapter is a wrapper for DataAdapter. It's impossible to use TableAdapters in generic way (bacause they inherit Component class). Is it possible to get the wrapped DataAdapter out of TableAdapter?
...
or do I have to use 2 separate DbDataAdapters with single-table Selects and then use DataRelations?
like:
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
I can't yet try this. I'm designing a xml config file schema for a general program so...
Within our unit tests we use plain ADO.NET (DataTable, DataAdapter) for preparing the database resp. checking the results, while the tested components themselves run under NHibernate 2.1. .NET version is 3.5, SqlServer version is 2005.
The database tables have identity columns as primary keys. Some tables apply instead-of-insert/update ...
I'm working with a legacy application which I'm trying to change so that it can work with SQL CE, whilst it was originally written against SQL Server.
The problem I am getting now is that when I try to do dataAdapter.Update, SQL CE complains that it is not expecting the SELECT keyword in the command text. I believe this is because SQL ...