Hi,
Please assist with the following.
How do I connect to SQL Server Express in VS2003? "Do I still use using System.Data.SqlClient;"?
What would the connection string be in the code? The following does not work.
try
{
string connectionString = "server=localhost;uid=webserver;pwd=wordpass;database=dbMV;";
// create a new SqlConnection object with the appropriate connection string
SqlConnection sqlConn = new SqlConnection(connectionString);
// open the connection
sqlConn.Open();
// do some operations ...
// close the connection
sqlConn.Close();
}
catch(Exception err)
{
Response.Write(err);
}
Try to write you connection string as following:
string connectionString = "server=localhost;User ID=webserver;pwd=wordpass;database=dbMV;";
For more information about connection string, please refer to:
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(d=ide).aspx
No comments:
Post a Comment