A
Arif Çimen
Hi all folks,
I wrote simple code like that:
try
{
//oleDbConnection1.="Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDBatabase Locking Mode=1;Data Source=".\Project Request
Database\ProjectRequestDB.mdb";Mode=Share Deny None;Jet OLEDB:Engine
Type=5;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet
OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt
Database=False;Jet OLEDB:Create System Database=False;Jet OLEDBon't Copy
Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk
Transactions=1";//../Project Request Database/ProjectRequestDB.mdb";
//oleDbConnection1.DataSource="../Project Request
Database/ProjectRequestDB.mdb";
string currDir=Server.MapPath("");
//string =Directory.GetCurrentDirectory();
currDir=currDir+"\\Project Request Database\\ProjectRequestDB.mdb";
oleDbConnection1.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="+currDir;
oleDbConnection1.Open();
oleDbCommand1.Parameters["Name"].Value=TextBox3.Text;
oleDbCommand1.Parameters["Surname"].Value=TextBox2.Text;
oleDbCommand1.Parameters["Project_Title"].Value=TextBox4.Text;
oleDbCommand1.Parameters["Project_Details"].Value=TextBox5.Text;
oleDbCommand1.Parameters["e_mail"].Value=TextBox6.Text;
//oleDbCommand1.Parameters[""].Value=TextBox3.Text;
oleDbCommand1.ExecuteNonQuery();
}
finally
{
oleDbConnection1.Close();
}
And the server error comes:
What may be the reason?
Thanks for any help.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Server Error in '/test' Application.
--------------------------------------------------------------------------------
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an
updateable query.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +67
Test.WebForm1.Button1_Click(Object sender, EventArgs e) in
e:\websayfamiz1\test\webform1.aspx.cs:97
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
I wrote simple code like that:
try
{
//oleDbConnection1.="Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDBatabase Locking Mode=1;Data Source=".\Project Request
Database\ProjectRequestDB.mdb";Mode=Share Deny None;Jet OLEDB:Engine
Type=5;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet
OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt
Database=False;Jet OLEDB:Create System Database=False;Jet OLEDBon't Copy
Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk
Transactions=1";//../Project Request Database/ProjectRequestDB.mdb";
//oleDbConnection1.DataSource="../Project Request
Database/ProjectRequestDB.mdb";
string currDir=Server.MapPath("");
//string =Directory.GetCurrentDirectory();
currDir=currDir+"\\Project Request Database\\ProjectRequestDB.mdb";
oleDbConnection1.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="+currDir;
oleDbConnection1.Open();
oleDbCommand1.Parameters["Name"].Value=TextBox3.Text;
oleDbCommand1.Parameters["Surname"].Value=TextBox2.Text;
oleDbCommand1.Parameters["Project_Title"].Value=TextBox4.Text;
oleDbCommand1.Parameters["Project_Details"].Value=TextBox5.Text;
oleDbCommand1.Parameters["e_mail"].Value=TextBox6.Text;
//oleDbCommand1.Parameters[""].Value=TextBox3.Text;
oleDbCommand1.ExecuteNonQuery();
}
finally
{
oleDbConnection1.Close();
}
And the server error comes:
What may be the reason?
Thanks for any help.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Server Error in '/test' Application.
--------------------------------------------------------------------------------
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an
updateable query.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +67
Test.WebForm1.Button1_Click(Object sender, EventArgs e) in
e:\websayfamiz1\test\webform1.aspx.cs:97
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292