I've begun to get exceptions when I try to write a DataRow, "Cannot
implicitly cnvert striung to double..." In the past I didn't have this
problem, but adding code to a solution that worked now throws exceptions:
The string WATERCODE and DBDate SAMPDATE are fine, but the Double STALEN
won't implicitly convert to a string as the value is assigned to the column
in the DataRow. I haven't changed any of the code or types between versions
of the solution, but I have upgraded from Visula Studio 2000 to 2005.
InsertCommand:
this.InsertCommand2.CommandText =
resources.GetString("InsertCommand2.CommandText");
this.InsertCommand2.Connection = this.DC1;
this.InsertCommand2.Parameters.AddRange(new
System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("WATERCODE",
System.Data.OleDb.OleDbType.VarWChar, 5, "WATERCODE"),
new System.Data.OleDb.OleDbParameter("SAMPDATE",
System.Data.OleDb.OleDbType.DBDate, 0, "SAMPDATE"),
new System.Data.OleDb.OleDbParameter("STA_LEN",
System.Data.OleDb.OleDbType.Double, 0, "STA_LEN"),
....
DataRow:
private void WriteSurveyRecord()
{
try
{
seTable.Clear();
seRow = seTable.NewRow();
seRow[0] = waterCode;
seRow[1] = sampDate;
seRow[2] = stationLength;
....
From the Microsoft training, I was told that the conversions would take
place from the string values stored in the DataRow to the table due to the
generated coding of the InsertCommand and it's mapping. Has this changed
with 2005?
--
Harry E Vermillion
IT2
Division of Wildlife
State of Colorado