How to connect SQL Server 2000 in visual studio.net 2005

How can i connect my ASP.NET web application with my sql server 2000. i used visual studio 2003, and there we drag and drop the data adapter and  then a sql connection and then use them in our application. but here we have only sqldatasource or something. so please tell me to make the connection and data retrieval procedure.

 


Kumud Tripathi
0
kumud
10/27/2007 9:02:37 AM
📁 asp.net.object-datasource
📃 16182 articles.
⭐ 0 followers.

💬 2 Replies
👁️‍🗨️ 1299 Views

You can drag a SQL Data Source object onto you web form and select configure data source. This will give you a wizard to connect to a database, and also allows you to set up insert, delete, update statements. You can then use this datasource to delete/update/select/insert data.

Alternatively you can do it all manually in code, by creating sqlconnections, sqlcommands, sqldataadapters and readers with datasets.

e.g.

 

SqlConnection oCon = new SqlConnection("your connection string");
string sQuery = "your SQL select statement";
SqlCommand oCmd = new SqlCommand(sQuery, oCon);
DataSet oDs = new DataSet();
SqlDataAdapter oDa = new SqlDataAdapter(oCmd);
oDa.Fill(oDs);
DataList1.DataSource = oDs;
DataList1.DataBind();

  

 

Here are some articles on the sql data source object 

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.aspx 

0
jimmy
10/27/2007 11:41:58 AM

thanks for the help sir. i got it now


Kumud Tripathi
0
kumud
10/28/2007 3:30:16 AM
Reply: