C#怎么连数据库
private String db_link = "server=服务器名;database=数据库名;uid=用户名;pwd=密码;pooling=true";
using (db = new SqlConnection(db_link))
{
SqlCommand command = db。 CreateCommand();
command。CommandText = "SELECT * FROM [Movie] WHERE mid=" + mid;
db。 Open();
SqlDataReader data = command。ExecuteReader();
if (data...全部
private String db_link = "server=服务器名;database=数据库名;uid=用户名;pwd=密码;pooling=true";
using (db = new SqlConnection(db_link))
{
SqlCommand command = db。
CreateCommand();
command。CommandText = "SELECT * FROM [Movie] WHERE mid=" + mid;
db。
Open();
SqlDataReader data = command。ExecuteReader();
if (data。
HasRows)
{
data。Read();
String pic_url = data["m_pic"]。
ToString();
}
}
。收起