.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Display data in msgbox from database

Posted By:satyapriyanayak       Posted Date: June 06, 2014    Points: 40    Category: Visual Studio    URL: http://www.dotnetspark.com  

In this Code Snippets we will know how to display data in msgbox from database.

Imports System.Data
Imports System.Data.OleDb
Public Class Form1
    Dim ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("dsn")
    Dim con As OleDbConnection = New OleDbConnection(ConnectionString)
    Dim com As OleDbCommand
    Dim oledbda As OleDbDataAdapter
    Dim ds As DataSet
    Dim dt As DataTable
    Dim str, sname As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        str = "select * from student"
        com = New OleDbCommand(str, con)
        Dim reader As OleDbDataReader = com.ExecuteReader
        While reader.Read()
            sname += reader(1) + vbCrLf
        End While
    End Sub
End Class


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend