Dim CmdAsNew OleDbCommand("SELECT UnitCost, TransportCosts FROM Products WHERE ProductID=@dotnet.itags.org.ProductID", DBConnection)
Cmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.ProductID", ProductID))
DBConnection.Open()
Cmd.ExecuteNonQuery()
Just do one read from the data reader. Adapt your code where appropiate (I'm going to do it in C# because I'm in a rush):
DBConnection.Open();
OleDbDataReader reader = Cmd.ExecuteReader();
if (reader.Read()) {
string unitCost = reader["UnitCost"].ToString();
string transportCost = reader["TransportCosts"].ToString();
// and do what ever you need - not "ideal" code but I think you'll get the idea.
}
// ...
Hi,
Firstly
ExecuteNonQuery does not return any rows.
You can use OleDbDataReader for this .
OleDbDataReader myReader =Cmd.ExecuteReader(CommandBehavior.CloseConnection);
while(myReader.Read())
{
Response.Write(myReader.GetString(0));
}
myReader.Close();
For more help
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbcommandclasstopic.asp
0 comments:
Post a Comment