0

私は学校のプロジェクトに取り組んでいますが、エラーが発生しています:

「サポートされていないキーワード: '統合セキュリティ'」

ここに写真があります:http://gyazo.com/5a16cde702601e20c811339c01b1911c

言語: オランダ語

コード:

 private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            string database = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\gip_stap_2\loonberekening.mdf;Integra‌​ted Security=True;Connect Timeout=30;InitialCatalog=loonberekening";
            SqlConnection myConn = new SqlConnection(database);
            SqlCommand Selectcommand = new SqlCommand("select * from loonberekening.tblInloggen where id = '" + this.txtGebruikersnaam.Text + "' and passwoord= '" + this.txtPaswoord.Text + "' ;", myConn);
            SqlDataReader myReader;
            myConn.Open();
            myReader = Selectcommand.ExecuteReader();
            int count = 0;
            while (myReader.Read())
            {
                count = count + 1;
            }
            if (count == 1)
            {
                MessageBox.Show("Gebruikersnaam en paswoord is correct");
                startmenu.ShowDialog();
            }
            else if (count > 1)
            {
                MessageBox.Show("Dit is een gedupliceerde paswoord en gebruikersnaam... Acces verboden");
            }
            else
            {
                MessageBox.Show("Username and paswoord zijn niet correct, Probeer opnieuw");
                myConn.Close();
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
4

2 に答える 2

0

データベースファイルが添付されている場合は、これを試してくださいSSMS

string database = @"Data Source=.; Integrated Security; 
                  Initial Catalog=loonberekening; Connect Timeout=30;"

特定のデータ ファイルを持つ LocalDB 自動インスタンスが必要な場合は、

string database = @"Server=(localdb)\v11.0;Integrated Security=true; 
                  AttachDbFileName=E:\gip_stap_2\loonberekening.mdf;"

注: これloonberekening.dbo.tblInloggenの代わりにこれloonberekening.tblInloggenを使用してくださいSelect Statement

このようなもの

SqlCommand Selectcommand = 
new SqlCommand("select * from loonberekening.dbo.tblInloggen where id = '" +
 this.txtGebruikersnaam.Text + "' and passwoord= '" + this.txtPaswoord.Text + "' ;", myConn);
于 2015-04-11T14:34:31.363 に答える