TiltingCode
Programmer
The below code works.... sort of. I can write the values to the console but what I want to do is store the values in strings. Only one row is returned with two fields.
As you can see I tried this two different ways and both work with the console but I can't get any to be stored in a string without erring out.
Can someone please help?
As you can see I tried this two different ways and both work with the console but I can't get any to be stored in a string without erring out.
Can someone please help?
Code:
string strSQL = "EXECUTE uspSelectStoredProcedure '" + strDocumentName + "'";
SqlDataAdapter DataAdapter = new SqlDataAdapter(strSQL, strConnection);
DataSet RS = new DataSet();
DataAdapter.Fill(RS);
System.Data.DataTable datTable = RS.Tables[0];
DataRow[] rows = datTable.Select("StoredProcedureName Is Not Null");
Console.WriteLine(rows[0][0]);
Console.WriteLine(rows[0][1]);
foreach (DataRow row in datTable.Rows)
{
foreach (DataColumn column in datTable.Columns)
{
Console.WriteLine(row[column]);
}
}