写入数据库问题 有一种简单做法,就是在设计这个表的时候,你把这个字段的默认值设为getdate(),这样在插入数据库的时候,不管这一列就行了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 数据库-表-设计-字段(datetime类型)-绑定默认值属性-getdate() SqlConnection conn = new SqlConnection("Data Source=PX-JCZX-05;Initial Catalog=wzgl;Integrated Security=True"); conn.Open(); string str1 = comboBox1.SelectedValue(); string str2 = TextBox3.Text.Trim(); string str3 = comboBox2.SelectedValue(); string str4 = dateTimePicker1.Value(); string str5 = TextBox5.Text.Trim(); string str6 = TextBox7.Text.Trim(); string str7 = dateTimePicker2.Value(); string sqlStr = "insert into sbcx(dw,xm,gh,xb,csny,jtzz,dh,rksj,zzmm,bz) values('" + str1 + "','" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str10 + "')"; SqlCommand cmd = new SqlCommand(sqlStr, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); conn.Close();这段代码哪里错了?怎么显示错误"System.Windows.Forms.ListControl.SelectedValue”是“属性”,但此处被当做“方法”来使用 问下大家除了c/c++,vb,还有那些语言是直接编译为二进制,不是通过虚拟机执行的呀? C#监听器 win7下,.net程序启动速度快了很多!!!! 为什么我的CheckBoxList获得的选中状态不正确? datagridview 分组小计 javascript 获取数据库信息 word文档解析[急HELP] [请教]关于项目引用的问题 急,求在C#中做无限级嵌套的树型菜单方法!能帮解决给100分! xbox360 计算身高的办法 分离字符串 请问c#中可以得到下拉列表的显示值吗?
conn.Open();
string str1 = comboBox1.SelectedValue();
string str2 = TextBox3.Text.Trim();
string str3 = comboBox2.SelectedValue();
string str4 = dateTimePicker1.Value();
string str5 = TextBox5.Text.Trim();
string str6 = TextBox7.Text.Trim();
string str7 = dateTimePicker2.Value();
string sqlStr = "insert into sbcx(dw,xm,gh,xb,csny,jtzz,dh,rksj,zzmm,bz) values('" + str1 + "','" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str10 + "')";
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
cmd.Dispose();
conn.Close();
这段代码哪里错了?
怎么显示错误"System.Windows.Forms.ListControl.SelectedValue”是“属性”,但此处被当做“方法”来使用