SQL Server does not exist or access denied.
Hi guys,
this is the error I get when I execute this code,
SqlConnection objConnection;
string strSQL;
SqlCommand objCommand;
string strConnection = "server=(Local)\\NetSDK;uid=sa;pwd=password;databa se=Northwind";
objConnection = new SqlConnection(strConnection);
objConnection.Open();
strSQL = "SELECT CustomerID, CustomerName FROM Customers WHERE Region = 'WA'";
//strSQL = "SELECT * FROM CustomerID";
objCommand = new SqlCommand(strSQL, objConnection);
//objCommand.CommandType = CommandType.StoredProcedure;
SqlDataReader objDR = objCommand.ExecuteReader();
if(objDR.HasRows)
{
datagrid.DataSource = objDR;
datagrid.DataBind();
}
else if(!objDR.HasRows)
{
Response.Write("oh no!");
}
does anyone know why??
Adz - The World is not enough
__________________
Adz - Learning The J2EE Ways.
|