Question about SELECT
Posted: Fri 02 May 2008 13:17
Hi,
I have this C# code to make a SELECT that follows my signature.
I'm sorry for the lame question, but although I've been a Linux and DB administrator for 15 years, I'm a total newbie to C# and MyDirect.NET.
I've read MyDirect manual and FAQ, but I didn't found what I'm looking for.
My question is, this SELECT statement returns a single value, a string.
How do I fetch it, i. e., how do I put the value coming from the SELECT statement into a variable ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
public void selectMyValue ()
{
string MyConnectionString;
myConnectionString="";
if (myConnectionString="")
{
myConnectionString="User Id=vpopmail; Host=192.168.1.4; Database="vpopmail"; Password="secret";
string myResult = "SELECT sha FROM vpopmail WHERE pw_name = 'gamito'";
MySQLCommand MyCommand = new MySQLCommand(myResult);
myCommand.Connection = myConn;
myConn.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (Excepction MyException)
{
Response.Write("Connection Error: " + MyException.Message);
}
myConn.Close();
}
I have this C# code to make a SELECT that follows my signature.
I'm sorry for the lame question, but although I've been a Linux and DB administrator for 15 years, I'm a total newbie to C# and MyDirect.NET.
I've read MyDirect manual and FAQ, but I didn't found what I'm looking for.
My question is, this SELECT statement returns a single value, a string.
How do I fetch it, i. e., how do I put the value coming from the SELECT statement into a variable ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
public void selectMyValue ()
{
string MyConnectionString;
myConnectionString="";
if (myConnectionString="")
{
myConnectionString="User Id=vpopmail; Host=192.168.1.4; Database="vpopmail"; Password="secret";
string myResult = "SELECT sha FROM vpopmail WHERE pw_name = 'gamito'";
MySQLCommand MyCommand = new MySQLCommand(myResult);
myCommand.Connection = myConn;
myConn.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (Excepction MyException)
{
Response.Write("Connection Error: " + MyException.Message);
}
myConn.Close();
}