bluezonemd
2008-05-27 05:02:00 UTC
I have tried something like this, but it won't reconize SQL connection? How can I also repost the data after ONButton Click on the same page to the datagrid?
OnButton Click
Dim sqlStmt As String
Dim conString As String
Dim cn As Sqlconnection (Won't reconize SQL connection)
Dim cmd As SqlCommand (Won't reconize SQL command)
Try
sqlStmt = "insert into Table1 (FName) Values (@Fname) "
conString = "Server and connection here is correct;"
cn = New SqlConnection(conString)
cmd = New SqlCommand(sqlStmt, cn)
cmd.Parameters.Add(New SqlParameter("@FName", SqlDbType.NVarChar, 11))
cmd.Parameters("@FName").Value = TxtBoxNewRN.Text
cn.Open()
cmd.ExecuteNonQuery()
Finally
cn.Close()
End Try