Manually insert ERROR msg into DataSet, then Return it

P

Pat

All,
I wrote a front end of a sql submitter for lack of better words.
Simply I am passing in a query ( strSQL ) built in a text box on the
client screen.
If it runs, I bind the data to a datagrid, all is well.
If there is an error (a mis-spelled field name in a table) the 'catch'
catches it along with the e.Message.
I just want to pass along the e.Message in the DataSet by manually
inserting the text of the e.Message and have the error message display
in the datagrid. I'd be happy to pass the error message back to a
label ir text box or whatever but I already have the code in place for
the datagrid and thought I might as well use it.
I am writing this as a 'Windows Application' in DotNet and running it
on my XP Pro box, not a web-app.
The code I tried is between the parentheses below:



public DataSet GetQueryData(string strInstance, string strSQL)
{
DataSet ds = new DataSet();
try
{
ds = GetDataSet(strSQL, strInstance);
}
catch(Exception e)
{
string x = e.Message;
x = x;

****************************************
ds.Tables[0].Rows.Add( string x HERE );
****************************************
}

return ds;
}

This should be pretty easy, but it's kicking me around. I've tried
creating a DataRow and many other things.

Thanks,
pgiambat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top