VB.NET中连接到数据库怎样关联到表啊?
的有关信息介绍如下:private void BindData()
{
SqlConnection con = new SqlConnection( "server=localhost;database=Northwind;integrated security=true;" );
SqlCommand cmd = new SqlCommand( "SELECT * FROM Customers", con );
try
{
con.Open();
myDataGrid.DataSource = cmd.ExecuteReader();
myDataGrid.DataBind();
con.Close();
}
catch( Exception ) {}
if( con != null && con.State == ConnectionState.Open )
con.Close();
}