Reputation: 1
I'm creating a register page . When I write connection string to connect to SQL Server 2014 , this error is shown: Error Pic
protected void btnsignup_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server=(local);DataBase=MyDataBase;integrated security=True");
SqlCommand cmd = new SqlCommand("insert into Users (Username,UPassword,Uname,UEmail) values ('"+ tbUname.Text + ","+ tbPass.Text + ","+tbname.Text +","+ tbemail.Text +"')");
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
Upvotes: 0
Views: 67
Reputation: 383
Like the error message shows you cannot login as that user (IIS/defaultapppool) on SQL server. Ususally this happens if:
Go to your SQL server management studio and make or edit your user. right click the security folder to make a new user, and make sure he is databaseReader, -Editor and/or databaseAdmin
You can also specify another user in your connectionstring by adding: User ID=name;Password=password
Upvotes: 3