Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
wleonard
Starting Member
30 Posts |
Posted - 2011-03-04 : 12:32:00
|
| using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){//Create the connection objectSqlConnection = new SqlConnection();// Set the connection stringconnection.ConnectionString = "Server=blah blah; " +"User ID=wleonard; Password=blah blah blah;" +"Database=opgi";// Open the connectionconnection.Open();}}What is wrong with my connection? The error message is as follows:Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'SqlConnection' does not exist in the current contextSource Error:Line 11: {Line 12: //Create the connection objectLine 13: SqlConnection = new SqlConnection();Line 14: // Set the connection stringLine 15: connection.ConnectionString = "Server=OPG4I; " +Source File: w:\originalpartsgroupSEO\CustomerReview\Default.aspx.cs Line: 13 .....comments please?-Cheers.Will Leonard |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-03-04 : 13:16:33
|
You have your username and password in the posting! Ouch!! Hope you are going to change it as soon as possible :--)quote: Originally posted by wleonard using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){//Create the connection objectSqlConnection connection = new SqlConnection();// Set the connection stringconnection.ConnectionString = "Server=OPG4I; " +"User ID=wleonard; Password=R3stor@tion;" +"Database=opgi";// Open the connectionconnection.Open();}}What is wrong with my connection? The error message is as follows:Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'SqlConnection' does not exist in the current contextSource Error:Line 11: {Line 12: //Create the connection objectLine 13: SqlConnection = new SqlConnection();Line 14: // Set the connection stringLine 15: connection.ConnectionString = "Server=OPG4I; " +Source File: w:\originalpartsgroupSEO\CustomerReview\Default.aspx.cs Line: 13 .....comments please?-Cheers.Will Leonard
|
 |
|
|
wleonard
Starting Member
30 Posts |
Posted - 2011-03-04 : 14:24:30
|
| Lol this is a play database it doesn't matter.Will Leonard |
 |
|
|
|
|
|