Jump to content

conection works fine but with IIS ooooo ?


eng.mohamed_elqpany

Recommended Posts

Hello every body, Firstly, thanx for every one helped me before. and now i have a problem with this code. It works fine when running it from visual studio.net but when i run it from IIS it geives me an exception.this is the code:

OleDbConnection con = new OleDbConnection();			con.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +			@"Data source= |DataDirectory|\\MaillingList.mdb";			try			{				con.Open();				string str;				str = "Insert Into news (NewDate,Title,Brief,Cate,news,imageUrl) values ('" + date + "','" + title + "','" + brief + "','" + category + "','" + news + "','" + ok + "')";				OleDbCommand cmd = new OleDbCommand(str, con);				cmd.ExecuteNonQuery();			}			catch (Exception ex)			{				Response.Write(ex.ToString());			}			finally			{				con.Close();			}

and this is the exception i have.System.Data.OleDb.OleDbException: Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at news_Default.Button1_Click(Object sender, EventArgs e) in c:\ProLight Site\news\contents.aspx.cs:line 176line 176 us the line of excute comandcmd.ExecuteNonQuery();i need ur help.with regards;..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...