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

            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")
8 Years
Discussion Span
Last Post by mnmw

Thanks guys, guess I got to get used to is. Datagrids approach not very flexible.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.