|
-
Sep 9th, 2002, 03:34 PM
#1
Thread Starter
Junior Member
Exception generated. HELP!!!!
Hi,
I have the following code which generates an exception. I am not sure what I am doing wrong.
------------------------------------------------------------------------------------
Dim InsertCmd1 As String = "INSERT INTO SITELIST (SITEID, SITENAME) VALUES (@SITEID, @SITENAME)"
MyCommand1 = New OleDBCommand(InsertCmd1, MyConnection)
MyCommand1.Parameters.Add(New OleDBParameter("@SITEID", OleDBType.VarChar, len("@SITEID")))
MyCommand1.Parameters("@SITEID").Value = txtSiteID.Value
MyCommand1.Parameters.Add(New OleDBParameter("@SITENAME", OleDBType.VarChar, len(txtSiteName.Value)))
MyCommand1.Parameters("@SITENAME").Value = txtSiteName.Value
MyCommand1.Connection.Open()
'Try
MyCommand1.ExecuteNonQuery()
'Catch Exc As OleDBException
' Message.InnerHtml = "ERROR: Could not add record. Check to ensure that both the Site ID and Site Name are unique."
' Message.Style("color") = "red"
'End Try
MyCommand1.Connection.Close()
----------------------------------------------------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|