asked on
public class QueryResults : List<object[]>
{
public void GetData(string SQL, params object[] RequestParams)
{
using (FbConnection ibCon = new FbConnection(DBConnection.CreateConnString()))
{
try
{
FbCommand cmdFBQuery = new FbCommand();
cmdFBQuery.Connection = ibCon;
cmdFBQuery.CommandType = CommandType.Text;
cmdFBQuery.CommandText = SQL;
int i = 0;
foreach (object obj in RequestParams)
{
cmdFBQuery.Parameters.Add(new FbParameter(i++.ToString(), obj));
}
ibCon.Open();
using (var reader = cmdFBQuery.ExecuteReader())
{
while (reader.Read())
{
var columns = new object[reader.FieldCount];
reader.GetValues(columns);
this.Add(columns);
}
}
}
catch (Exception ex)
{
// handle error here
}
}
}
}
ASKER
ASKER
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY
however, as there is no GetColumnNames() function like the GetValues, you have to loop on the columns.
something like this (untested, not on a PC with .net installed...)
Open in new window