A
Anthony M. Davis
Hi all,
I'm a little confused about how to obtain a result set from a stored
procedure (stored in a Visual FoxPro 8.0 database) from an ASP.NET web page
in order to populate a WebForms DataGrid control.
I've been experimenting using the code below but the only output i can get
is:
return_value
True
Here is attempt #1:
OleDbCommand selectCMD = new OleDbCommand("GetSurcharges", conn);
selectCMD.CommandType = CommandType.StoredProcedure;
selectCMD.CommandTimeout = 30;
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = selectCMD;
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds);
DataView dv = new DataView(ds.Tables[0]);
grdSurcharges.DataSource = dv;
grdSurcharges.DataBind();
conn.Close();
....and attempt #2 (same results as #1)
OleDbCommand selectCMD = new OleDbCommand("GetSurcharges", conn);
selectCMD.CommandType = CommandType.StoredProcedure;
selectCMD.CommandTimeout = 30;
//OleDbParameter sampParm = selectCMD.Parameters.Add("RETURN_VALUE",
OleDbType.Integer);
//sampParm.Direction = ParameterDirection.ReturnValue;
conn.Open();
OleDbDataReader reader = selectCMD.ExecuteReader();
grdSurcharges.DataSource = reader;
grdSurcharges.DataBind();
reader.Close();
conn.Close();
The VFP stored procedure is defined as follows:
PROCEDURE GetSurcharges
SELECT * FROM surcharge_application
ENDPROC
Thanks for your help,
Tony
I'm a little confused about how to obtain a result set from a stored
procedure (stored in a Visual FoxPro 8.0 database) from an ASP.NET web page
in order to populate a WebForms DataGrid control.
I've been experimenting using the code below but the only output i can get
is:
return_value
True
Here is attempt #1:
OleDbCommand selectCMD = new OleDbCommand("GetSurcharges", conn);
selectCMD.CommandType = CommandType.StoredProcedure;
selectCMD.CommandTimeout = 30;
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = selectCMD;
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds);
DataView dv = new DataView(ds.Tables[0]);
grdSurcharges.DataSource = dv;
grdSurcharges.DataBind();
conn.Close();
....and attempt #2 (same results as #1)
OleDbCommand selectCMD = new OleDbCommand("GetSurcharges", conn);
selectCMD.CommandType = CommandType.StoredProcedure;
selectCMD.CommandTimeout = 30;
//OleDbParameter sampParm = selectCMD.Parameters.Add("RETURN_VALUE",
OleDbType.Integer);
//sampParm.Direction = ParameterDirection.ReturnValue;
conn.Open();
OleDbDataReader reader = selectCMD.ExecuteReader();
grdSurcharges.DataSource = reader;
grdSurcharges.DataBind();
reader.Close();
conn.Close();
The VFP stored procedure is defined as follows:
PROCEDURE GetSurcharges
SELECT * FROM surcharge_application
ENDPROC
Thanks for your help,
Tony