解决方案 »
- win7 安装VS 2005打不开sdf数据库
- c# 总分店 数据传输问题
- winform 程序 缩放到右下角..就不会执行下面代码 有什么方法让它可以执行? 在线等
- 如何更新
- 设计器必须创建类型“System.Data.Common.DbDataAdapter”的实例,但该类型已声明为抽象,因此设计器无法创建该类型的实例
- FORM2中有个状态栏,怎么样把登陆界面(FORM1)中的用户名提取到该状态栏上显示呢?用户名连接后台数据库
- 在Panel的FindControl里,我怎么就是找不到动态生成的控件呢
- 多线程的问题
- 我发送到消息队列中的消息,过了几天就自动删除了,请问这是什么原因?
- [讨论]远程项目开发的项目管理与项目控制
- webservice发布后出问题,很着急。100分送上~~
- 如下这样一段代码,其中 Type.Missing到底是什么意思,起什么作用啊?先感谢前辈了!
Sqlcommond cmd =new Sqlcommond();
textBox.Text=cmd.ExecuteScalar().ToString();
SqlCommond cmd =new SqlCommond();//创建命令对象
//这里要打开连接
//connection con.Open()
textBox1.Text=cmd.ExecuteScalar().ToString();//执行查询并显示
using System.Data.SqlClient;using(SqlConnection con = new SqlConnection("Data Source=.;uid=sa;pwd=sa;Database=Northwind"))
{
con.Open();
string strsql6 = "select count(sno) from student where cno='" + class1 + "' and cet4>425";
SqlCommand cmd = new SqlCommand(strsql6,con);
this.TextBox1.Text = cmd.ExecuteScalar().ToString();
}
using System.Data.SqlClient;using(SqlConnection con = new SqlConnection("Data Source=.;initial catalog=Northwind;user id=sa;password=sa"))
{
string strsql6 = "select count(sno) from student where cno=@class1 and cet4>425";
using(SqlCommand cmd = new SqlCommand(strsql6,con))
{
con.Open();
cmd.Parameters.AddWithValue("@class1",class1);
this.TextBox1.Text = cmd.ExecuteScalar().ToString();
}
}