14 years ago
Error with assigning OleDbCommand.Parameter
Hello,
The last line of following C# Script code:
var con = dotNET["System_Data_OleDb"]["OleDbConnection"]["zctor"]("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\mydb.accdb");
con.Open();
cmd.CommandText = "INSERT INTO [Users](ID,Nickname) VALUES( @id, @nick)";
cmd.Parameters.Add("id", 3);
cmd.Parameters.Add("nick", 202);
cmd.Parameters["id"].Value = 0;
Fails with 'Parameters.id is null or not an object' error. How do I set the value?
//Misha
The last line of following C# Script code:
var con = dotNET["System_Data_OleDb"]["OleDbConnection"]["zctor"]("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\mydb.accdb");
con.Open();
cmd.CommandText = "INSERT INTO [Users](ID,Nickname) VALUES( @id, @nick)";
cmd.Parameters.Add("id", 3);
cmd.Parameters.Add("nick", 202);
cmd.Parameters["id"].Value = 0;
Fails with 'Parameters.id is null or not an object' error. How do I set the value?
//Misha