SQL command or Manual Query Qustions?

AukI

Member
Joined
Nov 20, 2010
Messages
17
Programming Experience
3-5
Hi guys,

After getting dataset's datatable by using wizard ,we can update those tables rows or table by calling that table's adapter. Like blow:

Code:
 Me.Validate()
            Me.DepartmentBindingSource.EndEdit()
            Me.DesignationBindingSource.EndEdit()
            Me.TableAdapter.Update(Me.DataSet1.table)
But think we have a manual table , now we want to update,insert or delete data manually.. but only by those above simple commands ... so should I try create dataAdapter for that Table.

Below there is an example for creating commands for select,insert,update,delete but those doesn't work as above should put someting more in it.

Code:
    Dim adapter As SqlDataAdapter = New SqlDataAdapter


    ' Create the commands.
    adapter.SelectCommand = New SqlCommand( _
        "SELECT CustomerID, CompanyName FROM CUSTOMERS", connection)
    adapter.InsertCommand = New SqlCommand( _
        "INSERT INTO Customers (CustomerID, CompanyName) " & _
         "VALUES (@CustomerID, @CompanyName)", connection)
    adapter.UpdateCommand = New SqlCommand( _
        "UPDATE Customers SET CustomerID = @CustomerID, CompanyName = " & _
        "@CompanyName WHERE CustomerID = @oldCustomerID", connection)
    adapter.DeleteCommand = New SqlCommand( _
        "DELETE FROM Customers WHERE CustomerID = @CustomerID", connection)
 

AukI

Member
Joined
Nov 20, 2010
Messages
17
Programming Experience
3-5
By manual table , I mean no wizard connection fully programmatic connection from a database.
 
Top Bottom