N
N. Okan Guney
Hello,
How could I read just one cell out of a dataset?
I have a query returing a 3 x 3 table.
a b c
d e f
x y z
I need the value of "f" ([2][2] ) from the table. How could I do this using
C#?
Thanks in advance,
System.Data.DataSet onhand(string partno) {
string connectionString = "server=\'sql01\'; trusted_connection=true;
database=\'data03\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "SELECT [inmast].[fonhand] FROM [inmast] WHERE
(([inmast].[fpartno] = \'"+partno+"\') AND" + " ([inmast].[fcstscode] =
\'A\'))";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
dbCommand.CommandText = queryString; dbCommand.Connection = dbConnection;
System.Data.IDbDataAdapter dataAdapter = new
System.Data.SqlClient.SqlDataAdapter();
dataAdapter.SelectCommand = dbCommand; System.Data.DataSet dataSet = new
System.Data.DataSet();
dataAdapter.Fill(dataSet);
return dataSet;
}
How could I read just one cell out of a dataset?
I have a query returing a 3 x 3 table.
a b c
d e f
x y z
I need the value of "f" ([2][2] ) from the table. How could I do this using
C#?
Thanks in advance,
System.Data.DataSet onhand(string partno) {
string connectionString = "server=\'sql01\'; trusted_connection=true;
database=\'data03\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "SELECT [inmast].[fonhand] FROM [inmast] WHERE
(([inmast].[fpartno] = \'"+partno+"\') AND" + " ([inmast].[fcstscode] =
\'A\'))";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
dbCommand.CommandText = queryString; dbCommand.Connection = dbConnection;
System.Data.IDbDataAdapter dataAdapter = new
System.Data.SqlClient.SqlDataAdapter();
dataAdapter.SelectCommand = dbCommand; System.Data.DataSet dataSet = new
System.Data.DataSet();
dataAdapter.Fill(dataSet);
return dataSet;
}