Visual Basic .NET » Database Programming
newbie SQL insert VB.net Question -- Pete --


I am trying to develop some code to allow me to enter a new record into an MSSQL table (code is below). Currently this code inserts a record and gives it a new autonumber but does not populate the Title,
Firstname or Secondname fields.
Any advise greatly appreciated.
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click

localsource.InsertParameters.Add("@ID", 3)
localsource.InsertParameters.Add("@Title",
System.Data.SqlDbType.Text, "ggg")
localsource.InsertParameters.Add("@Firstname",
System.Data.SqlDbType.Text, "ggg")
localsource.InsertParameters.Add("@Secondname",
System.Data.SqlDbType.Text, "ggg")

Try
localsource.Insert()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub

[Submit Comment]Home