hey, im using C# to write to databases, i can do it though a normal exe normal but when i try and do it though a web page cgi and stuff, it just comes up with an error
Quote:
System.Data.OleDb.OleDbException: Operation must use an updateable query.
Printable View
hey, im using C# to write to databases, i can do it though a normal exe normal but when i try and do it though a web page cgi and stuff, it just comes up with an error
Quote:
System.Data.OleDb.OleDbException: Operation must use an updateable query.
it might be that the database is read only and/or the server is not setup to use an access database...
..Im assuming you are using an access database..
im using an access database. i can read write and do every thing to it normaly. but when i try to do it though my server it doesnt work? do i have to set the server up to let C# write though the server, coz it can read from it, but it can write?
is this server remote...or yours?
yer its hosted on my own computer and im running wun2k SP2
make sure that your web application virtual directory is set up with write permissions.
ypu the persmission are set to read, write and the execute permission are set to scripts and exectuables.
hmm..well I am out of ideas and am about to leave work..If I come up with anything tonight, ill let you know.
thanks any way:)
What is the error your getting?
its not the code, because ive tryed it using VB asp and none of them will work when i try to write it though my webserver?Quote:
Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
Hmm it should be writing some error to the browser..? Does it not display anything?
sorry, it displays that in the browser with some other stuff, but when i run it from a folder normaly theres no problems? could it be something with IIS?
Send me your code and db I will try to test it over here.
rgds,
abhijit
ive sorted it out now it was something to do with the IIS user config, they didn't have the access rights.
thanks :D
Hey John,
Could you perhaps post the code your using to connect to the database? It seems like it might do what i need(to mysql).
Thanks,
-toto
i used mdb, and it was compiled to a exe
Code:using System.Data.OleDb;
class zzz
{
public static void Main()
{
try
{
OleDbConnection s;
s = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\\c#\\myDB.mdb");
s.Open();
OleDbCommand c;
string t;
t=System.Environment.GetEnvironmentVariable("QUERY_STRING");
//t = "aa=john&bb=tindell";
string [] u;
char [] v = new char[2];
v[0] = '=';
v[1] = '&';
u = t.Split(v);
string f1,f2,f3;
f1 = u[1].Replace('+',' ');
f2 = u[3].Replace('+',' ');
f3 = "insert into bbb values('" + f1 + "','" + f2 + "')";
System.Console.WriteLine("Content-Type:text/html\n");
System.Console.WriteLine(f3);
c=new OleDbCommand(f3,s);
c.ExecuteNonQuery();
}
catch(System.Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
hey, do you know how to handle a file upload?