Click here to Skip to main content
15,907,326 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
We want to apply Add, Update and delete etc. multiple queries on single table using single dataset and SqlDataAdapter.
If possible, how to do this and how to get resulted records from them?
Posted
Updated 8-May-11 4:33am
v2
Comments
Sandeep Mewara 8-May-11 9:30am    
Your question is not clear. Please use 'Improve Question' link and update the question - rephrase it, be a little more elaborate.

public SqlConnection con;

    public SqlCommand cmd;
    public SqlDataAdapter adp;
    public DataSet ds;
    
    public void Connection()
    {
        con = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=accounting;Data Source=HOME-D5073E143B");
        con.Open();
    }
    public DataSet FillData(string MyString)
    {
        Connection();
        adp = new SqlDataAdapter(MyString,con);
        ds = new DataSet();
        adp.Fill(ds);
        
        return ds;
    }

Place this in a class. And call the function any no of times.
 
Share this answer
 
Try with this link it may help you

Using-LINQ-to-SQL-to-return-Multiple-Results.aspx[^]
 
Share this answer
 
Thanks, Its working fine. We can also call this FillData() method from other methods to solve our purpose by just passing our queries.
Take my 5.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900