Jiyalal Gupta

Jiyalal Gupta

  • NA
  • 36
  • 15.7k

login failed for user error

Mar 6 2015 4:27 PM
i'm getting login failed for user     error plz help me
 
 
my code is
 
 
app.config
 
 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="WindowsFormsApplication1.Properties.Settings.Database1ConnectionString"
connectionString="Data Source=jiyalal-pc\SQLEXPRESS;Initial Catalog= Database1;Integrated Security=false;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
 
 
 
and my WindowsFormsApplication1.cs code
 
 
private void button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["WindowsFormsApplication1.Properties.Settings.Database1ConnectionString"].ConnectionString);
con.Open();
SqlCommand com = new SqlCommand("insert into tt values('" + textBox1.Text + "')", con);
int h = com.ExecuteNonQuery();
if (h > 0)
{
MessageBox.Show("saved");
}
con.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
 
plz help 
 
 
 
 

Answers (1)