Hello guys i've been stuck here for 2 days. I want when i full in my textboxes that the text will go to my database "loonberekening into my table werknemer". But now im getting this
error: An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
Additional information: Keyword not supported: 'integrated security'
.
and he is ticking this line: SqlConnection cnnLoonberekening = new SqlConnection(database);
Thanks for helping me and here is my code!
private void btnOpslaanwerknemergegevens_Click(object sender, EventArgs e)
{
string database = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\gip_stap_2\loonberekening.mdf;Integrated Security=True;Connect Timeout=30;InitialCatalog=loonberekening";
string werknemergegevens = "insert into loonberekening.werknemer (naam,voornaam) values ('"+this.txtNaam.Text+"','"+this.txtVoornaam.Text+"');";
SqlConnection cnnLoonberekening = new SqlConnection(database);
SqlCommand scmdLoon = new SqlCommand(werknemergegevens, cnnLoonberekening);
SqlDataReader check;
try{
cnnLoonberekening.Open();
check = scmdLoon.ExecuteReader();
MessageBox.Show("Opgeslagen");
while (check.Read())
{
}
}catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}