January 7, 2004 at 11:02 pm
Hello!! I am the very beginner for developing ASP web application. I am now urgently to write ASP web application by connecting to MS SQL Server 2000. I would like to know how to use datagrid to access data inside the SQL Server 2000 through ASP .NET. Thanks you for kind attention!!
January 8, 2004 at 11:16 am
With such a generic post, I don't think you'll get many responses, so I thought I'd at least send you a URL. You can find some sample code and tutorial information on using datagrids with ASP.NET at the following page: http://www.411asp.net/home/tutorial/specific/web/userinte/webcontr/datagrid
Good luck!
January 9, 2004 at 6:37 am
Umm, yeah...read up on ADO.NET? I would start by doing some research on the subject before posting something. However, I have pity today...below is a VERY generic routine...
Dim sqlCon As New Data.SqlClient.SqlConnection("Data Source=MyServer;Initial Catalog=MyDB;UID=UserName;PWD=Password")
Dim sqlAdapter As New SqlClient.SqlDataAdapter("Select * From [Table]", sqlCon)
Dim dsData As New Data.DataSet("MyData")
sqlAdapter.Fill(dsData)
dgDataGrid.DataSource = dsData
'Clean Up
If (Not IsNothing(sqlAdapter)) Then sqlAdapter.Dispose: sqlAdapter = Nothing
If (Not IsNothing(sqlCon)) Then sqlCon.Dispose: sqlCon = Nothing
'NOTE: Do Not Destroy the DataSet or the Grid will not display Data
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply