Inserting updating and deleting data with the sqldatasource Free chat aunty
I cannot do this by setting the Insert Command property to an INSERT statement.What I found is that I could use a Stored Procedure. Could I attache some C# code to the Sql Data Source that does the insert? It does not like the label assignment at the bottom, is where it craps out string dd1 = (Drop Down List1. the table in sql Server is like this CREATE TABLE Milestone ( ID int identity(1,1) NOT NULL PRIMARY KEY, Branch varchar(max) NOT NULL default '', KO varchar(max) NOT NULL default 'f', KS varchar(max) NOT NULL, Customer varchar(50) NOT NULL, PR_Received datetime NOT NULL, PR_MIPR varchar(50) NOT NULL, RFP_CONTRACT varchar(50) NOT NULL, Descrip nvarchar(max) NOT NULL) I have commented out the insert part where insertion is done. You may also examine the resources below: Automatic operations with Sql Data Source control in hierarchical grid Insert/Update/Delete with stored procedures and Sql Data Source control By default Rad Grid extracts the values from the column editors for all columns of the currently edited Grid Item when updating or inserting a new record unless they are set as read-only.When deleting an item, Rad Grid extracts the values from the cells of the Grid Item that is to be deleted.
Extracting values from an Item is supported only when the grid has an edit mode of In Place or Edit Forms (auto-generated edit forms) or uses a template.You must configure the data source so that it supports the automatic operations.You also need to set the Data Key Names property of the table views in the grid so that the insert, update, and delete operations perform as expected." Select Command="SELECT [Order ID], [Customer ID], [Employee ID], [Order Date], [Ship Name] FROM [Orders]" Delete Command="DELETE FROM [Orders] WHERE [Order ID] = @Order ID" Insert Command="INSERT INTO [Orders] ([Customer ID], [Employee ID], [Order Date], [Ship Name]) VALUES (@Customer ID, @Employee ID, @Order Date, @Ship Name)" Update Command="UPDATE [Orders] SET [Customer ID] = @Customer ID, [Employee ID] = @Employee ID, [Order Date] = @Order Date, [Ship Name] = @Ship Name WHERE [Order ID] = @Order ID" The following articles describe how to configure some of the more common Data Source controls: For a tutorial that uses automatic CRUD operations feature, see Add controls to column templates.For a live example that demonstrates automatic data source operations, see Automatic operations.
Actually, the way autonumber works (at least I think he means autonumber) you insert all other fields except the ID that is getting auto-incremented.