c# - "Format of the initialization string does not conform to specification starting at index 0." -
i got error:
format of initialization string not conform specification starting @ index 0.
my code :
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.data.sqlclient; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.security.cryptography; using system.data.oledb; using system.configuration; namespace librarysystem { public partial class pidd : form { public pidd() { initializecomponent(); } private void button1_click(object sender, eventargs e) { this.close(); frmmed med = new frmmed(); med.show(); var conn = new sqlconnection("connectionstring"); //var command = new sqlcommand("patient.dbo.p_id", connection); var command = new sqlcommand("select p_id patient id='" + textbox1.text + "",connection); connection.open(); var reader = command.executereader(); if (reader.read()) { textbox1.text = reader["id"].tostring(); } else { // no entry found } connection.close(); } private void textbox1_textchanged(object sender, eventargs e) { } public sqlconnection connection { get; set; } } } i'm trying write id exists in db , check if id correct ,, show in next fram ,,
format of initialization string not conform specification starting @ index 0. argumentexception message giving bad connection string sqlconnection(string) constructor: give valid sql server connection string (i.e. not "connectionstring"), , ready move on tackling other issues in code.
for reference, can see how quickly, minimally morphed code confirm source of given error message in linqpad 4:

Comments
Post a Comment