sqlcommandbuilder

Can you use ADO.NET SQLCommandBuilder with composite keys?

I have a database table with 6 columns. The primary key is a composite key made up of 5 of the 6 columns I am trying to use the SqlClient.SqlCommandBuilder.GetDeleteCommand to delete the row. However I am getting the following error: "System.InvalidOperationException : Dynamic SQL generation for the DeleteCommand is not supported again...

SqlCommandBuilder using table name instead of view

I am using a SqlCommandBuilder object to generate update statements from Select statements in a SqlDataAdapter. My problem is that in my Select statement I am selecting from a view called vwUsers. the SqlCommandBuilder object I used generated an update statement for the table Users not the view vwUsers. How can I override that behavior ...

SqlCommandBuilder and SQL Server Computed Columns - Error

What is the right way to avoid errors on INSERT and UPDATES with a SqlDataAdapter/SqlCommandbuilder when the SQL Statement used to SELECT has a computed column as one of the return fields? I get the error now that "The column Amount cannot be modified because it is either a computed column or is the result of a UNION operator". UPDATE:...

Use of SqlCommandBuilder in ASP.NET

Hi, I have used the following code to add the feedback entered to the web form into a database. The code works fine. But when I try to deleted thi statement SqlCommandBuilder objcb = new SqlCommandBuilder(objDa); I am getting an error I mean it is executing the else part. Can any one tell me what is the use of SqlCommandBuilder? ...

SqlCommandBuilder.DeriveParameters(command) and IsNullable

I have written an O/R database wrapper that generates some wrapper methods for stored procs it reads from the database. Now I need to produce some custom wrapper code if an input parameter of a stored proc is defaulted to NULL. The problem is - I get stored proc parameters using: SqlCommandBuilder.DeriveParameters(command) and it do...

WinForms DataGridView - update database

I know this is a basic function of the DataGridView, but for some reason, I just can't get it to work. I just want the DataGridView on my Windows form to submit any changes made to it to the database when the user clicks the "Save" button. I populate the DataGridView according to a function triggered by a user selection in a DropDownLi...

CommandBuilder and SqlTransaction to insert/update a row

I can get this to work, but I feel as though I'm not doing it properly. The first time this runs, it works as intended, and a new row is inserted where "thisField" contains "doesntExist" However, if I run it a subsequent time, I get a run-time error that I can't insert a duplicate key as it violate the primary key "thisField". static...

Does SqlCommandBuilder.GetUpdateCommand() need to be called before using SqlDataAdpater.Update()?

When I use a SqlCommandBuilder to push updates/inserts/deletes to the server do I need to call .GetUpdateCommand(), .GetInsertCommand(), and .GetDeleteCommand()? using (var adapter = new SqlDataAdapter("select * from MyTable", _connection)) using (var builder = new SqlCommandBuilder(adapter)) { adapter.Fill(dt); //Magic happens...

What is use of Command Builder in ASP.NET ?

Command builder builds Parameter Object. What does it mean by parameter object? Why are they created ? Why does Derive Parameter method need extra round trip to Data store ? ...

update a dataset corresponding to a database from it's datagridview

there is a datagridview corresponding to a table of some database. this database has a identity (auto-incrementing) column named "id".this column is primary key,also. user just see a blanked and empty datgridview.he/she can modify this table(datagridview) for example add new row,remove it,edit(update)one cell and can do every possible mo...