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#のデータベースエラーが
すでに&チェックして「指定されたファイルを開くことができない、またはそれがUNC共有に配置されている」と仮定するとA database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
私は自分のコードにどのように追加しますか?角かっこの中だけで? – user1300788
SqlConnection con =新しいSqlConnection(@ "サーバー=。\ SQLEXPRESS;データベース=ハッシュタグ;統合セキュリティ= sspi"); – richk