请高手指教:如何把DataTimePicker里的日期加到ACCESS数据库的问题 应该是。strInsert += dtpdate.Text + "')" ;改为strInsert += dtpdate.Value.ToShortDateString()+ "')" ;试一下。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 帅哥我按照你写的改了下,还把datetimepicker的FORMAT属性改为了short还是不行,请各位大侠再帮我看看,紧! VALUES ( '" ;strInsert += tbxname.Text + "', #" ;strInsert += tbxtelphone.Text + "#)" ; 你需要设置日期的格式,插入和修改的时候最好用参数来传递,例如:string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;strInsert += tbxname.Text + "', " ;strInsert += tbxtelphone.Text + ", " ;"@myDate)" ;OleDbCommand inst = new OleDbCommand ( strInsert , myConn ) ;inst.Parameters.Add("@myDate",dtpdate);inst.ExecuteNonQuery ( ) ;myConn.Close ( ) ; Sorry,把string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;strInsert += tbxname.Text + "', " ;strInsert += tbxtelphone.Text + ", " ;"@myDate)" ;改为string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" + tbxname.Text + "', " + tbxtelphone.Text + ", " + "@myDate)" ; Sorry,把string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;strInsert += tbxname.Text + "', " ;strInsert += tbxtelphone.Text + ", " ;"@myDate)" ;改为string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" + tbxname.Text + "', " + tbxtelphone.Text + ", " + "@myDate)" ; 关于GetDataTable的问题 怎么做单元测试? c#里面有没有友元函数 桌面图标窗口句柄的获取 ListView如何删除选定项啊? 请教 请问自定义的类如果在生成实例的时候出现错误,一般都用什么方法解决? 怎样得到Form当前是否被激活的状态 C# 调用C++中写的DLL 出现问题!敬请各位朋友帮忙! 取不到DropDownList的值 杭州的.net程序员请进,高分相送! 关于TreeView问题 简单问题,马上结DataGridItem oDataGridItem用这个对象要引用哪个命名空间?
strInsert += tbxname.Text + "', #" ;
strInsert += tbxtelphone.Text + "#)" ;
string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;
strInsert += tbxname.Text + "', " ;
strInsert += tbxtelphone.Text + ", " ;
"@myDate)" ;
OleDbCommand inst = new OleDbCommand ( strInsert , myConn ) ;
inst.Parameters.Add("@myDate",dtpdate);
inst.ExecuteNonQuery ( ) ;
myConn.Close ( ) ;
把
string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;
strInsert += tbxname.Text + "', " ;
strInsert += tbxtelphone.Text + ", " ;
"@myDate)" ;
改为
string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '"
+ tbxname.Text + "', "
+ tbxtelphone.Text + ", "
+ "@myDate)" ;
把
string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '" ;
strInsert += tbxname.Text + "', " ;
strInsert += tbxtelphone.Text + ", " ;
"@myDate)" ;
改为
string strInsert = " INSERT INTO tel ( name , telphone , date ) VALUES ( '"
+ tbxname.Text + "', "
+ tbxtelphone.Text + ", "
+ "@myDate)" ;