M
Marco Martin
Hi,
I've got an oledb parameter that I'm sending to an Access DB.
The table I'm sending it to has a column called "Zone" of type String that
has a default value of "".
So I create the parameter with its name and dbType, and add it to an
Insertcommand.
I then set the Command.Text value.
Sample code goes like this;
....
OleDBParameter prmZone = new OleDBParameter("Zone", OleDbType.VarChar);
prmZone.SourceColumn = myDataSet.tblRecords.ZoneColumn;//Using a typed
dataset
cmdInsert.Parameters.Add(prmZone);
cmdInsert.CommandText = "INSERT INTO tblRecords VALUES(ID, Zone...)";
RecordsAdapter.InsertCommand = cmdInsert;
RecordsAdapter.Update(myDataSet, "tblRecords");
When I run this code, I get a run-time error "Parameter Zone has no default
value".
If my table has a default value, and the parameter gets assigned a value
from the dataset (I checked and there are no blank fields), why would I get
this error?
Any thoughts would be appreciated.
Regards,
Marco
I've got an oledb parameter that I'm sending to an Access DB.
The table I'm sending it to has a column called "Zone" of type String that
has a default value of "".
So I create the parameter with its name and dbType, and add it to an
Insertcommand.
I then set the Command.Text value.
Sample code goes like this;
....
OleDBParameter prmZone = new OleDBParameter("Zone", OleDbType.VarChar);
prmZone.SourceColumn = myDataSet.tblRecords.ZoneColumn;//Using a typed
dataset
cmdInsert.Parameters.Add(prmZone);
cmdInsert.CommandText = "INSERT INTO tblRecords VALUES(ID, Zone...)";
RecordsAdapter.InsertCommand = cmdInsert;
RecordsAdapter.Update(myDataSet, "tblRecords");
When I run this code, I get a run-time error "Parameter Zone has no default
value".
If my table has a default value, and the parameter gets assigned a value
from the dataset (I checked and there are no blank fields), why would I get
this error?
Any thoughts would be appreciated.
Regards,
Marco