我连接的数据库是.dbf文件
string insertSQL = "insert into [sg0510wyys.dbf] (mondate,stname,w_temp) " +"VALUES (?, ?, ?)";OdbcCommand insertCMD = new OdbcCommand(insertSQL, cnn);
da.InsertCommand = insertCMD;
da.InsertCommand.Parameters.Add("@mondate", OdbcType.DateTime);
da.InsertCommand.Parameters["@mondate"].SourceColumn="mondate";
da.InsertCommand.Parameters.Add("@stname", OdbcType.VarChar);
da.InsertCommand.Parameters["@stname"].SourceColumn="stname";
da.InsertCommand.Parameters.Add("@w_temp", OdbcType.Decimal);
da.InsertCommand.Parameters["@w_temp"].SourceColumn="w_temp";
da.Fill(ds,"table1");
this.dataGrid1.DataSource=ds.Tables["table1"].DefaultView;
====================================================================
DataAdapter的insetcommand,updatecommand,selectcommand,deletecommand都已写好,
数据库中的w_temp字段是数字类型decimal
问题是当我在dataGrid中新添数据后,用update不能将数据写入数据库中,因为@w_temp的值通过sourcecolumn取得的值是字符串(虽然定义为decimal,但从DataTable中读出就为字符串了),而在前面的insert语句中VALUES (?, ?, ?)的第三个参数?必须为decimal才能插入到数据库中,
请问如何将如何办,转换类型????????在线等待!!!!