|
-
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()
----------------------------------------------------------------------------------
-
Sep 10th, 2002, 01:30 AM
#2
Fanatic Member
Re: Exception generated. HELP!!!!
Originally posted by kprashan
Hi,
I have the following code which generates an exception. I am not sure what I am doing wrong.
It would help if you posted the error message.
John
-
Sep 10th, 2002, 08:30 AM
#3
Thread Starter
Junior Member
Finally figured it out
The exception being generated was an 'Could not update query' kind of thing. I had to go to the folder where the database was residing, go to the security permissions and give the write permission to everyone.
MS has already documented this on their website.
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
|