Manually insert ERROR msg into DataSet, then Return it

Discussion in 'ASP .Net' started by Pat, Jan 29, 2004.

  1. Pat

    Pat Guest

    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
     
    Pat, Jan 29, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. D
    Replies:
    3
    Views:
    693
    Mark Rae
    Sep 3, 2006
  2. akila_natarajan

    Read .msg attachment from a mail(.msg)

    akila_natarajan, May 13, 2011, in forum: Java
    Replies:
    0
    Views:
    390
    akila_natarajan
    May 13, 2011
  3. Replies:
    0
    Views:
    296
  4. Charles Lowe
    Replies:
    0
    Views:
    226
    Charles Lowe
    May 13, 2007
  5. Charles Lowe
    Replies:
    0
    Views:
    173
    Charles Lowe
    Aug 22, 2007
Loading...

Share This Page