sukabrojali
New Member
Im trying to get a simple add to work (actually I'm trying to get a detailed Add to work but first things first). I am following an example from the Tips & Tricks sample chapters. Here is my code. For the most part it is the same as the sample with some different names and my Access DB. The DB table name an field are correct. When I run this code I get "Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query." on the line of objCmd.ExecuteNonQuery(). This worked for me last weekend and now I can't even get this to work. I've tried it on a couple of .Net IIS servers. Any suggestions?<BR><BR><BR><%@ Page Language="vb" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><BR><html><BR> <head><BR> <title>NewTest</title><BR> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0"><BR> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0"><BR> <meta name="vs_defaultClientScript" content="JavaScript"><BR> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"><BR> </head><BR> <body MS_POSITIONING="GridLayout"><BR> <BR> <%<BR> Dim objConn As OleDbConnection<BR> Dim objCmd As OleDbCommand<BR> <BR> objConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C: est.mdb" )<BR> objConn.Open()<BR> <BR> objCmd = New OleDbCommand("INSERT INTO Information (FirstName) VALUES ('Dave')", objConn)<BR> objCmd.ExecuteNonQuery()<BR> objConn.Close<BR> %> <BR> <BR> <BR>New Record added.<BR> </body><BR></html><BR>David, <BR>I copied your code onto my machine and creatd a copy of your database.<BR><BR>I got the example to run and do an add to the database with only a few lines added.<BR><BR>Take a look at the code below. I did all caps for anything I added.<BR><BR>Hope it helps you.<BR><BR>Tom T<BR><BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <BR><%@ Page Language="vb" %> <BR><%@ Import Namespace="System.Data" %> <BR><%@ Import Namespace="System.Data.OleDb" %> <BR><BR><html> <BR><head> <BR><title>NewTest</title> <BR><meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0"> <BR><meta name="CODE_LANGUAGE" content="Visual Basic 7.0"> <BR><meta name="vs_defaultClientScript" content="JavaScript"> <BR><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <BR></head> <BR><body MS_POSITIONING="GridLayout"> <BR><BR><SCRIPT RUNAT="SERVER"><BR><BR>SUB PAGE_LOAD(SENDER AS OBJECT, E AS EVENTARGS) <BR><BR> Dim objConn As OleDbConnection <BR><BR> Dim objCmd As OleDbCommand <BR><BR> objConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C: est.mdb") <BR><BR> objConn.Open() <BR><BR> objCmd = New OleDbCommand("INSERT INTO Information (FirstName) VALUES ('Dave')", objConn)<BR> <BR> objCmd.ExecuteNonQuery() <BR><BR> objConn.Close <BR><BR> RESPONSE.WRITE("NEW RECORD ADDED.")<BR> <BR>END SUB<BR><BR></SCRIPT><BR><BR></body> <BR></html> <BR>