Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 27, 2012 11:44 AM by jamshed alam
Member
196 Points
126 Posts
May 26, 2012 09:09 AM|LINK
using System.Data.SqlClient; using System.Web.Configuration; public partial class _Default : System.Web.UI.Page { String ConnStr = WebConfigurationManager.ConnectionStrings["Sqlconn"].ConnectionString; protected void SUBMIT_Click(object sender, EventArgs e) { SqlConnection Conn = new SqlConnection(ConnStr);// ERROR OVER HERE SqlCommand Cmd; SqlDataReader Dr; Conn.Open(); String SqlStr = "SELECT Username,Password FROM Login" + " WHERE Username='" + TxtUsername.Text + "' and Password='" + TxtPassword.Text + "'"; Cmd = new SqlCommand(SqlStr, Conn); Dr = Cmd.ExecuteReader(); if (Dr.Read()) { if (DrpSelect.SelectedItem.Value == "W") { Response.Redirect("WCO.aspx"); } else if (DrpSelect.SelectedItem.Value == "G") { Response.Redirect("GMINVOICE.aspx"); } else if (DrpSelect.SelectedItem.Value == "S") { Response.Redirect("sales.aspx"); } else if (DrpSelect.SelectedItem.Value == "SEL") { Lblerror.Visible = true; } else { Lblerror.Visible = true; Lblerror.Text = "enter the username and password correctly"; } } Lblerror.Visible = true; Lblerror.Text = "enter the username and password correctly"; Conn.Close(); } }
All-Star
97829 Points
14494 Posts
May 26, 2012 09:20 AM|LINK
check your connectionstring for right format.....for valid connectionstrings - http://connectionstrings.com/
Thanks,
May 26, 2012 09:27 AM|LINK
When i surfed google, i too got this link but i didnt find the solution , no errr in connection string
<connectionStrings> <add name ="Sqlconn" connectionString ="Data Source=ACCOUNTS2\SQLEXPRESS;Initial Catalog=FIRST;Persist Security Info=True;User ID=sa;password:xxxxx"/> </connectionStrings>
Star
7983 Points
2099 Posts
May 26, 2012 11:15 AM|LINK
pls change
using System.Configuration;
String ConnStr = ConfigurationManager.ConnectionStrings["Sqlconn"].ConnectionString;
May 26, 2012 11:25 AM|LINK
HAI RAMESH,
I AM USING WEBCONFIGURATION ,SO I HAVE INCLUDE BOTH SYSTEM & WEB CONFIG I NAME SPACE BUT I HAVE PASSED THE CONNECTION STRING IN WEB CONFIG SO I HAVE USE LIKE PREVIOUS POST......ANY OTHER SOLUTION
May 27, 2012 11:31 AM|LINK
Hai
change u r webconfig connectionstring
<connectionStrings> <add name ="Sqlconn" connectionString ="Data Source=ACCOUNTS2\SQLEXPRESS;Initial Catalog=FIRST;Persist Security Info=True;User ID=sa;password=xxxxx"/> </connectionStrings>
thank u
319 Points
105 Posts
May 27, 2012 11:44 AM|LINK
i think there something wrong in your user name and password or user permission
try to Persist Security Info=false and check
THINESH
Member
196 Points
126 Posts
ERROR AT RUNTIME: Format of the initialization string does not conform to specification starting ...
May 26, 2012 09:09 AM|LINK
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class _Default : System.Web.UI.Page
{
String ConnStr = WebConfigurationManager.ConnectionStrings["Sqlconn"].ConnectionString;
protected void SUBMIT_Click(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection(ConnStr);// ERROR OVER HERE
SqlCommand Cmd;
SqlDataReader Dr;
Conn.Open();
String SqlStr = "SELECT Username,Password FROM Login"
+ " WHERE Username='" + TxtUsername.Text + "' and Password='" + TxtPassword.Text + "'";
Cmd = new SqlCommand(SqlStr, Conn);
Dr = Cmd.ExecuteReader();
if (Dr.Read())
{
if (DrpSelect.SelectedItem.Value == "W")
{
Response.Redirect("WCO.aspx");
}
else if (DrpSelect.SelectedItem.Value == "G")
{
Response.Redirect("GMINVOICE.aspx");
}
else if (DrpSelect.SelectedItem.Value == "S")
{
Response.Redirect("sales.aspx");
}
else if (DrpSelect.SelectedItem.Value == "SEL")
{
Lblerror.Visible = true;
}
else
{
Lblerror.Visible = true;
Lblerror.Text = "enter the username and password correctly";
}
}
Lblerror.Visible = true;
Lblerror.Text = "enter the username and password correctly";
Conn.Close();
}
}
ramiramilu
All-Star
97829 Points
14494 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 26, 2012 09:20 AM|LINK
check your connectionstring for right format.....for valid connectionstrings - http://connectionstrings.com/
Thanks,
JumpStart
THINESH
Member
196 Points
126 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 26, 2012 09:27 AM|LINK
When i surfed google, i too got this link but i didnt find the solution , no errr in connection string
<connectionStrings>
<add name ="Sqlconn" connectionString ="Data Source=ACCOUNTS2\SQLEXPRESS;Initial Catalog=FIRST;Persist Security Info=True;User ID=sa;password:xxxxx"/>
</connectionStrings>
RameshRajend...
Star
7983 Points
2099 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 26, 2012 11:15 AM|LINK
pls change
using System.Configuration;
String ConnStr = ConfigurationManager.ConnectionStrings["Sqlconn"].ConnectionString;
THINESH
Member
196 Points
126 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 26, 2012 11:25 AM|LINK
HAI RAMESH,
I AM USING WEBCONFIGURATION ,SO I HAVE INCLUDE BOTH SYSTEM & WEB CONFIG I NAME SPACE BUT I HAVE PASSED THE CONNECTION STRING IN WEB CONFIG SO I HAVE USE LIKE PREVIOUS POST......ANY OTHER SOLUTION
RameshRajend...
Star
7983 Points
2099 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 27, 2012 11:31 AM|LINK
Hai
change u r webconfig connectionstring
<connectionStrings>
<add name ="Sqlconn" connectionString ="Data Source=ACCOUNTS2\SQLEXPRESS;Initial Catalog=FIRST;Persist Security Info=True;User ID=sa;password=xxxxx"/>
</connectionStrings>
thank u
jamshed alam
Member
319 Points
105 Posts
Re: ERROR AT RUNTIME: Format of the initialization string does not conform to specification start...
May 27, 2012 11:44 AM|LINK
i think there something wrong in your user name and password or user permission
try to Persist Security Info=false and check