begginer ASP question-plz help

Joined
Dec 17, 2007
Messages
1
Reaction score
0
public static string change()
{
SqlConnection sqlConnection1 = new SqlConnection("Provider=SQLOLEDB; Data Source=iwsql02.fe-works.com\\TEST; Initial Catalog=nccrt-cs2;User Id=nccrt_cs2;Password=nccrt_cs2;");
SqlCommand cmd = new SqlCommand();
//Object returnValue;

cmd.CommandText = "SELECT PostDate FROM CS_Posts WHERE (ThreadID = 11)";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;

sqlConnection1.Open();

returnValue = cmd.ExecuteScalar();

sqlConnection1.Close();
return returnValue;
}
I am getting the error
The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top