If you want to run several queries, you can run them one by one. You
could also create a stored procedure that runs all the queries or use
an ad-hoc SQL string (not recommended, of course) that combines all
the queries and execute that.

If you want to run several queries *simultaneously*, you will require
separate connections to the database.



On Aug 2, 12:51 pm, Harish Kumar <[email protected]> wrote:
> Hi Developers....
>
> I am developing a window based application. In this, i have connected
> it to the SQL server via SQL Client database connectivity. through
> this i can run query from Front End.
>
> SqlConnection con1 = new SqlConnection();
>
> con1.ConnectionString = "Data Source=**.**.**.**;Initial Catalog=<my
> database>;User ID=<my user id>;Password=<my passwd.>";
>
> string query = select * from My_table_name;
>
> SqlDataAdapter da1 = new SqlDataAdapter(query, con1);
> SqlCommandBuilder cb = new SqlCommandBuilder(da1);
>
> DataTable dt = new DataTable();
> dt.Locale = System.Globalization.CultureInfo.InvariantCulture;
> da1.Fill(dt);
> bindingSource1.DataSource = dt;
>
> dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExc­eptHeader);
> dataGridView1.ReadOnly = true;
> dataGridView1.DataSource = bindingSource1;
>
> but the above code run only one query. I want to run several queries
> like:
>
> query1=select ....................
> query2=insert into............
> query3=select................where./....................
>
> etc.
>
> thank u :)

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to