Weird, adding a record to a access db

doug

New Member
I have two servers, one with WinXP, running all the latest updates and the .NET SDK, the second one is Windows 2000 Advanced Server and running the .NET SDK.<BR><BR>The 2000 advanced server is my intranet server, the WinXP one is my test PC, the PC I work on before publishing my code. I insert a record to a database on my PC now problem, but when it gets to the intranet server, it doesn't want to add the record and gives me the normal "Jet database engine error". Now I debugged and it said something along the lines of "The query must be an updatable query"<BR><BR>Here is my code, I have no idea what could be wrong :<BR>Dim sConnstr As String<BR> sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbdatabase.mdb") <BR><BR> 'Open connection before populating the DataReader <BR> Dim objConn as New OleDbConnection(sConnStr) <BR><BR><BR> Dim objDs As DataSet <BR> Dim objCmd As OleDbCommand <BR> Dim strInsertCommand As String = "INSERT INTO Company (Com_Name) VALUES (@CompanyName)" <BR><BR> objCmd = New OleDbCommand(strInsertCommand, objConn) <BR> objCmd.Parameters.Add(New OleDbParameter("@CompanyName", OleDbType.VarChar, 255))<BR><BR> objCmd.Parameters("@CompanyName").Value = http://aspmessageboard.com/archive/index.php/addcompany.text<BR> objCmd.Connection.Open() <BR><BR> Try <BR> objCmd.ExecuteNonQuery() <BR><BR> Catch Exp As OleDbException <BR> Response.Write("Error Occured: " & Exp.Source) <BR> End Try <BR><BR> objCmd.Connection.Close()
 
Back
Top