winform编码连接sql,调试没有反应 form里拖放一个DataGridView和一个BindingSource,编译没有错误 代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;
namespace 快餐店win代码 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string conn_string = "Data Source=yh-20120602uzvz\\SQLNEW;Initial Catalog=FastFood;Integrated Security=True";//连接字符串 string sql = "Select CustomerID,userName,Password,Email form Customer";//查询select语句 SqlConnection conn = new SqlConnection(conn_string);//创建连接对象 SqlCommand cmd = new SqlCommand();//创建执行SQL命名形象