I have been using the code below to edit SQL database fields from the data stored in a dataset. Problem is I have to repeat this long code for each database field to be edited....I find this very tiring...IS THERE A SHORTER WAY OF EDITING SQL Database FIELDS. (Am using VS 2005 and SQL Server 2005
'3. Create an Update command
Dim strUpdateAccounts As String = "UPDATE Accounts SET Description = @Description"
'create a SqlCommand object and assign it to the UpdateCommand property
daDataAdaptor.UpdateCommand = New SqlCommand(strUpdateAccounts, con)
'set up parameters in the sqlCommand object
Dim param As SqlParameter
'@Description
param = daDataAdaptor.UpdateCommand.Parameters.Add(New SqlParameter("@Description", SqlDbType.VarChar, 150))
param.SourceColumn = "Description"
param.SourceVersion = DataRowVersion.Current
'Update the database table with the dataset details
daDataAdaptor.Update(dsDataSet, "Accounts")
MsgBox(" Updated Sucessfully")