Friday, February 24, 2012

Connection string problem.

+ ex {"The name \"CHARACTER\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."} System.Exception {System.Data.SqlClient.SqlException}
+ dr {System.Data.DataRow} System.Data.DataRow
dr[1] "CHARACTER" object {string}
dr[2] "NAME" object {string}
dr[3] "14/09/2006 12:00:00 AM" object {string}
dr[4] "" object {string}
dr[5] "1" object {string}
dr[6] "1" object {string}
dr[7] "1" object {string}
dr[8] "" object {string}
dr[9] "" object {string}
dr[10] "80" object {string}
dr[11] "False" object {string}
dr[12] "" object {string}
dr[13] "" object {string}
dr[14] "" object {string}
dr[15] "" object {string}
dr[16] "True" object {string}
dr[17] "False" object {string}
dr[0] "1" object {string}
edtProjectName.Text.Trim() This expression causes side effects and will not be evaluated string
+ ex {"The name \"CHARACTER\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."} System.Exception {System.Data.SqlClient.SqlException}

public ProjectToDB(string _projectDBName)

{

projectDBName = "RG_ProjectData_"+_projectDBName;

conn = new SqlConnection("Initial Catalog=??;Data Source=10.1.1.99;user id=sa;password=Password123");

}

?this needs to be placed by projectDBNamestring projectDBName = "pubs";
SqlConnection objconn = new SqlConnection("Initial Catalog=" + projectDBName + @.";Data Source=192.168.1.1;user id=sa;password=passwd123");

Quote:

Originally Posted by macupryk

+ ex {"The name \"CHARACTER\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."} System.Exception {System.Data.SqlClient.SqlException}
+ dr {System.Data.DataRow} System.Data.DataRow
dr[1] "CHARACTER" object {string}
dr[2] "NAME" object {string}
dr[3] "14/09/2006 12:00:00 AM" object {string}
dr[4] "" object {string}
dr[5] "1" object {string}
dr[6] "1" object {string}
dr[7] "1" object {string}
dr[8] "" object {string}
dr[9] "" object {string}
dr[10] "80" object {string}
dr[11] "False" object {string}
dr[12] "" object {string}
dr[13] "" object {string}
dr[14] "" object {string}
dr[15] "" object {string}
dr[16] "True" object {string}
dr[17] "False" object {string}
dr[0] "1" object {string}
edtProjectName.Text.Trim() This expression causes side effects and will not be evaluated string
+ ex {"The name \"CHARACTER\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."} System.Exception {System.Data.SqlClient.SqlException}

public ProjectToDB(string _projectDBName)

{

projectDBName = "RG_ProjectData_"+_projectDBName;

conn = new SqlConnection("Initial Catalog=??;Data Source=10.1.1.99;user id=sa;password=Password123");

}

?this needs to be placed by projectDBName

No comments:

Post a Comment