SqlConnection con = new SqlConnection(@"Server=.\SQLEXPRESS;AttachDbFilename='C:\HashTags.mdf';Integrated Security=True;User Instance=True");
con.Open();
String queryStr = "SELECT name FROM ttable WHERE name LIKE '*%'";
SqlCommand com = new SqlCommand(queryStr, con);
SqlDataReader sdr = com.ExecuteReader();
while (sdr.Read())
{
this.trendingBx.Text = sdr.GetValue(0).ToString();
}
sdr.Close();
誰能告訴我,爲什麼我得到這個錯誤:C#數據庫錯誤
A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
我將如何添加到我的代碼?只是在括號內? – user1300788 2012-04-19 20:00:18
SqlConnection con = new SqlConnection(@「Server =。\ SQLEXPRESS; Database = HashTags; Integrated Security = sspi」); – richk 2012-04-19 21:05:43