c# - Format of the initialization string does not conform to specification starting at index 50 -
i have no idea means, can please
"format of initialization string not conform specification starting @ index 50."
code:
initializecomponent(); connstring = "data source=.\\sqlexpress;attachdbfilename=c:\\users\andrew\\documents\\vinyl0.mdf;integrated security=true;connect timeout=30;user instance=true"; query = "select * record"; dadapter = new sqldataadapter(query, connstring); //this error appears. dtable = new datatable(); cbuilder = new sqlcommandbuilder(dadapter); cbuilder.quoteprefix = "["; cbuilder.quotesuffix = "]"; mydataview = dtable.defaultview; dadapter.fill(dtable); bindingsource bndsource = new bindingsource(); bndsource.datasource = dtable;
i suspect problem:
c:\\users\andrew
\a
escape sequence "alert" character (u+0007)... suspect wanted backslash followed "a". unlucky didn't compile-time error, you'd have done if you'd had \j
or other invalid escape sequence.
i suggest using verbatim string literal instead, don't need double backslashes:
connstring = @"data source=.\sqlexpress;attachdbfilename=c:\users\andrew\documents\vinyl0.mdf;integrated security=true;connect timeout=30;user instance=true";
Comments
Post a Comment