C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET GridView »

A database example


Posted Date: 16 Sep 2009    Resource Type: Code Snippets    Category: ASP.NET GridView
Author: joseph sajMember Level: Gold    
Rating: 1 out of 5Points: 5



This code shows a database example


<html>
<head>
<script langauge="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim stringConnectionString As String
Dim stringSql As String
Dim objConnection As System.Data.OleDb.OleDbConnection
Dim objCommand As System.Data.OleDb.OleDbCommand
Dim objDataReader As System.Data.OleDb.OleDbDataReader
Dim i As Integer
Dim sTemp As String
Dim stringMapPath As String
stringConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
stringMapPath = Server.MapPath("sampledb.mdb")
stringConnectionString = stringConnectionString & stringMapPath
objConnection = New System.Data.OleDb.OleDbConnection(stringConnectionString)
objConnection.Open()
stringSql = "SELECT * FROM tblSample"
objCommand = New System.Data.OleDb.OleDbCommand(stringSql, objConnection)
objDataReader = objCommand.ExecuteReader()
Response.Write("<table border=1 cellpadding=1 cellspacing=1>")
Do While objDataReader.Read
Response.Write("<tr>")
Response.Write("<td>" & objDataReader.Item("url") & "</td>")
Response.Write("<td>" & objDataReader.Item("desc") & "</td>")
Loop
Response.Write("</table><br><br>")
objDataReader.Close()
objConnection.Close()
End Sub

</script>
</head>



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
A database example  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Creating sitemap of a website
Previous Resource: A drawing example
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET GridView


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use