sql server query in asp.net 4.0?

ApurvA

New member
JAI MATADI ..

hello .. i m trying to add a record through asp.net 4.0 in (Windows Application - Vb.net) into sql server 3.5 (which is in asp.net 4.0)

here is my code ..
----------------------------------------------------------------------------------
dim connstr as string = "my sql database connection string"
-------------------------------
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim conn As New SqlConnection(connstr)
conn.Open()
Dim qry As String
qry = "insert into Table2 (email,mob) values(' " & TextBox3.Text & "','" & TextBox4.Text & " ' where pname=' " & TextBox1.Text & " ', lname=' " & TextBox2.Text & "')"
Dim cmd As New SqlCommand(qry, conn)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Successfully Inserted")
else
MsgBox("Error")

End If
End Sub

----------------------------------------------------------------------------------

but what i m getting error is ..

"Incorrect Syntax near the keyword 'where' "
-----------------

well i have used TabControl tool in that in first TAb the user will input First Name and Last Name which is working fine ..

and the second tab the user will input the Email and his/her mobile no .. but its not working .. saying the above error ..

please tell me whts wrong i m doing in this syntax ..

thank you ..
 
Back
Top