Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Incorrect syntax near 'nvarchar'.

Author  Topic 

liping
Starting Member

2 Posts

Posted - 2008-01-17 : 09:15:24
Hi, I hav this error when I try to delete/edit the user information from database using the SQLDataSource. Pls Help Me!! Thank you!

Protected Sub bn_reset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bn_reset.Click
tb_name.Text = ""
tb_add.Text = ""
tb_telNo.Text = ""
tb_birth.Text = ""
tb_email.Text = ""
tb_nameCredit.Text = ""
tb_expiry.Text = ""
tb_cardNo.Text = ""
tb_cvvCode.Text = ""
tb_bank.Text = ""
tb_loginId.Text = ""
tb_pswd.Text = ""
tb_confirmPswd.Text = ""
End Sub

Protected Sub bn_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bn_submit.Click
Session("myLoginId") = tb_loginId.Text
Session("myPassword") = tb_pswd.Text

Dim cn As New SqlClient.SqlConnection()
cn.ConnectionString = ConfigurationManager.ConnectionStrings("CustomerCS").ConnectionString

Dim sql As String
sql = "Insert into CustomerTable(Name,Gender,Address,Telephone,Birthdate,Email,[Name(Credit Card)],[Credit No],[Expiry date],[CVV2/CVC2 code],[Credit Card Bank],[Login ID],Password)"
sql = sql & "Values (@pName,@pGender,@pAdd,@pTel,@pBirth,@pEmail,@pNameCredit,@pCreditNo,@pExp,@pCode,@pBank,@pLogin,@pPswd)"

Dim cmd As New SqlCommand(sql, cn)
cmd.Parameters.AddWithValue("@pName", tb_name.Text)
cmd.Parameters.AddWithValue("@pGender", rb_gender.SelectedValue)
cmd.Parameters.AddWithValue("@pAdd", tb_add.Text)
cmd.Parameters.AddWithValue("@pTel", tb_telNo.Text)
cmd.Parameters.AddWithValue("@pBirth", tb_birth.Text)
cmd.Parameters.AddWithValue("@pEmail", tb_email.Text)
cmd.Parameters.AddWithValue("@pNameCredit", tb_nameCredit.Text)
cmd.Parameters.AddWithValue("@pCreditNo", tb_cardNo.Text)
cmd.Parameters.AddWithValue("@pExp", tb_expiry.Text)
cmd.Parameters.AddWithValue("@pCode", tb_cvvCode.Text)
cmd.Parameters.AddWithValue("@pBank", tb_bank.Text)
cmd.Parameters.AddWithValue("@pLogin", tb_loginId.Text)
cmd.Parameters.AddWithValue("@pPswd", tb_pswd.Text)

cn.Open()
cmd.ExecuteNonQuery()
cn.Close()
cmd.Dispose()
cn.Dispose()

Response.Redirect("Confirmation.aspx")
End Sub
End Class

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-17 : 09:29:18
I can see only insert here.Where r u performing update/delete?
Go to Top of Page

liping
Starting Member

2 Posts

Posted - 2008-01-17 : 09:42:18
I actually using the the gridview box and the sqlDatasource to build an administrator page to select,delete & edit. But i can only select.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-01-18 : 04:24:36
You could alternatively issue a stored procedure command , which you can build in the logic of UPDATE / INSERT / DELETE

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -