G
Guest
Dear Newsgroup:
I am trying to insert records into an access database
using VS.NET (ASP.NET) however I continuely receive the
error "Operation must use an updateable query" when I
execute the objCmd.ExecuteNonQuery() command.
The stored procedure is right out of Chris Payne's book
ASP.NET in 21 days: "INSERT INTO tblUsers (UserName,
Password, FirstName...) VALUES (@username, @Password,
@Firstname ...)
This I put in an access query saved as spAddUser. When I
run it in Access it works fine. When I let ASP.NET run
it w/ the following code it continuely crashes. Any help
would greatly be appreciated.
Thanks,
Dave Corwith
(e-mail address removed)
Public Sub AddUser(ByVal objUser As UserDetails)
Dim intID As Integer
Dim objReader As OleDbDataReader
Dim objCmdID As New OleDbCommand("SELECT MAX
(UserID) FROM tblUsers", objConn)
Dim objCmd As New OleDbCommand("spAddUser",
objConn)
objCmd.CommandType =
CommandType.StoredProcedure
Dim objParam As New OleDbParameter
("@username", OleDbType.Char)
objParam.Value = objUser.UserName
objCmd.Parameters.Add(objParam)
Try
objConn.Open()
objCmd.ExecuteNonQuery()
objUser.UserID = CType
(objCmdID.ExecuteScalar, Integer)
Catch e As Exception
Throw e
End Try
..
I am trying to insert records into an access database
using VS.NET (ASP.NET) however I continuely receive the
error "Operation must use an updateable query" when I
execute the objCmd.ExecuteNonQuery() command.
The stored procedure is right out of Chris Payne's book
ASP.NET in 21 days: "INSERT INTO tblUsers (UserName,
Password, FirstName...) VALUES (@username, @Password,
@Firstname ...)
This I put in an access query saved as spAddUser. When I
run it in Access it works fine. When I let ASP.NET run
it w/ the following code it continuely crashes. Any help
would greatly be appreciated.
Thanks,
Dave Corwith
(e-mail address removed)
Public Sub AddUser(ByVal objUser As UserDetails)
Dim intID As Integer
Dim objReader As OleDbDataReader
Dim objCmdID As New OleDbCommand("SELECT MAX
(UserID) FROM tblUsers", objConn)
Dim objCmd As New OleDbCommand("spAddUser",
objConn)
objCmd.CommandType =
CommandType.StoredProcedure
Dim objParam As New OleDbParameter
("@username", OleDbType.Char)
objParam.Value = objUser.UserName
objCmd.Parameters.Add(objParam)
Try
objConn.Open()
objCmd.ExecuteNonQuery()
objUser.UserID = CType
(objCmdID.ExecuteScalar, Integer)
Catch e As Exception
Throw e
End Try
..