插入ORACLE数据的问题
OracleDataReader pdr = gs.GetReader(strd);
pdr.Read();
if (pdr.HasRows)
{
string stname = pdr["NAME"].ToString().Trim();
string stset = pdr["GENDER"].ToString().Trim();
string stzy = pdr["yy"].ToString().Trim();
string stid = claname.SendNameValue.ToString().Trim();
string usidd = "okok";
string bm = "公安厅";
string xm = "共计";
string sstin = "insert into m.me (BARCODE,NAME,GENDER,DESC,TIME,ID,MENT_NAME,USER_NAME) VALUES('" + stid + "','" + stname + "','" + stset + "','" + stzy + "',to_date('" + DateTime.Now + "','YYYY:MM:DD:HH24:MI:SS'),'" + usidd + "','" + bm + "','" + xm + "')";
if (gs.GetExecute(sstin))
{
label1.Text = pdr["READER_NAME"].ToString().Trim();
}
在VS2008上运行,没有报错,label1.Text有显示,但数据库没有数据.
在另外一台电脑上VS2012运行,一些正常.数据库有数据.
快疯了,是什么问题呀.
高手支招呀
------解决方案--------------------我的建议:
string sstin = "insert into m.me (BARCODE,NAME,GENDER,DESC,TIME,ID,MENT_NAME,USER_NAME) VALUES('" + stid + "','" + stname + "','" + stset + "','" + stzy + "',to_date('" + DateTime.Now + "','YYYY:MM:DD:HH24:MI:SS'),'" + usidd + "','" + bm + "','" + xm + "')";
这句话调试看一下,或者直接写成常量看看,如:
string sstin = "insert into m.me (BARCODE,NAME,GENDER,DESC,TIME,ID,MENT_NAME,USER_NAME) VALUES('000001','syd','','',‘2013-11-13 14:31:01’,'111','111','111')";
看看在vs2008上是否可以正常插入数据库?