I wanna just a beginning for my coding. (The application running with VB.NET and SQL server) I did this code and it not shown any error. After this process it is displayed the message "Successfully updated". But data is not update on the table. Please tell me, how to update the table?

This is my code....

    Dim conStr As String
    conStr = "Data Source=MY-PC\SQLEXPRESS;Initial Catalog=MyAccounts; Integrated Security=True"
    Dim objConn As New SqlConnection(conStr)
    objConn.Open()

    Dim DAaccounts As New SqlDataAdapter("Select * From Accounts", objConn)

    Dim DSmyAcc As New DataSet("MyAccounts")
    DAaccounts.FillSchema(DSmyAcc, SchemaType.Source, "Accounts")
    DAaccounts.Fill(DSmyAcc, "Accounts")

    Dim tblAcc As DataTable
    tblAcc = DSmyAcc.Tables("Accounts")

    Dim drCurrent As DataRow
    drCurrent = tblAcc.NewRow()

    drCurrent("Acc_ID") = 200
    drCurrent("Acc_Name") = "Test Acc"

    tblAcc.Rows.Add(drCurrent)
    MsgBox("Add was successful.")
    objConn.Close()

Which table are you referring to exactly? The tblAcc, the Accounts table in the dataset or the database table? Because you have no code that will alter the last two. Your code to add a row to tblAcc looks right so how are you checking that tblAcc has no new rows?

First of all thank you for the reply hericles.

Database : MyAccounts
Table : Accounts

If I tell basically, I just want to add new row to database table. Cant i do it with this code?

This article has been dead for over six months. Start a new discussion instead.