Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Importing data from Access Database


Importing data from Access Database

Reply
  #1 (permalink)  
Old 04-13-04, 01:07 PM
dmiranda dmiranda is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question Importing data from Access Database

Using database "mydb.mdb" (which has one field with three records) , how do I import data from that to a label on my ASP form?

For instance the database looks like this:

myfield
------
record1
record2
record3

When I open up my page, I would like the label to automatically show the first record on the database, that is, 'record1'

How do I do this?

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 04-20-04, 01:07 PM
wessamzeidan wessamzeidan is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Lebanon
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Dim cn As new OledbConnection("yourconnectiontring")
Dim qry As String="select * from yourtable"
Dim cm as New OledbCommand(qry,cn)
Dim dr as OledbDataReader

cn.Open()
dr=cm.ExecuteReader()
If dr.Read
label1.Text=dr.Item(0)
End If
dr.Close()
cn.Close()
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 questions 1-Webbased database access. 2-PDF data retrieval Mehre PHP 1 04-11-04 04:20 AM
Dreamweaver and access database Gian79 ASP 4 01-25-04 09:10 PM
QueryString and retrieve data from database pjm ASP 3 08-11-03 02:21 PM
importing data from MS Access to Excel using ASP craigger1 ASP 1 08-05-03 03:11 PM


All times are GMT -5. The time now is 02:53 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.