i need the complete code for retreiving the data from a database.. i m coding in visual web developer and using VB as coding language. I m using SQL SERVER as database handler.
-
3there are many examples on the web: google.co.nz/…. Maybe you have a slightly more specific example of what you're trying to achieve.Preet Sangha– Preet Sangha2009-10-06 09:36:20 +00:00Commented Oct 6, 2009 at 9:36
-
What kind of database? SQL Server? Access?Kramii– Kramii2009-10-06 10:06:46 +00:00Commented Oct 6, 2009 at 10:06
Add a comment
|
2 Answers
Shared Dim con As SqlConnection
Shared Sub Main()
con = New SqlConnection("Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI")
' Create the command object
Dim str As String = "SELECT ID, FirstName, LastName FROM Employee"
Dim cmd As New SqlCommand(str, con)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, "Employee")
gridview1.datasource=ds;//
gridview1.databind();// to bind the data to gridview
its will be help to u..