constr = "server=ADTL; uid=sa; pwd=;DSN=northwind";
OdbcConnection conn = new OdbcConnection(constr);
conn.Open();
OdbcCommand cmd = new OdbcCommand();
cmd.Connection = conn;
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "Insert into Script_info Values(@scriptco, @scriptname, @currentPrice, @time)";
cmd.Parameters.Add("@scriptco", scriptco);
cmd.Parameters.Add("@scriptname", scriptname);
cmd.Parameters.Add("@currentPrice", currentPrice);
cmd.Parameters.Add("@script_type", scripttype);
cmd.Parameters.Add("@time", time);
cmd.ExecuteNonQuery();
but each time i run this code it throws an OdbcException of: missing Expression on the line (cmd.ExecuteNonQuery()).......
how do i avoid this exception.
Plz help: i have a problem in the OdbcCommand object in the following C#.Net code!?
Not that I've ever tried this, but it looks like if you're using OdbcCommand, you don't get to use named parameters. See http://msdn2.microsoft.com/en-us/library... and http://archives.postgresql.org/pgsql-hac...
Reply:Does one of the parameter values which you are adding to the parameter collection of your command contain double quotes?
To pinpoint why your error is being generated, insert a breakpoint at the cmd.ExecuteNonQuery() and check the exact SQL Statement being executed against your datasource.
Hope this helps
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment