Geeks Talk

Prepare for your Next Interview




Asp.net 2.0 page loaded from MS Access

This is a discussion on Asp.net 2.0 page loaded from MS Access within the ASP.NET forums, part of the Web Development category; Hi, I'm new at this .net programming world but trying to learn. I am trying to create a webpage that loads it's information from an MS Access database ...


Go Back   Geeks Talk > Web Development > ASP.NET

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-13-2008
Junior Member
 
Join Date: Jan 2008
Location: Wisconsin
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
AspPage is on a distinguished road
Question Asp.net 2.0 page loaded from MS Access

Hi, I'm new at this .net programming world but trying to learn. I am trying to create a webpage that loads it's information from an MS Access database in Microsoft Visual Web Developer 2005 Express. It work in the testing inviroment, but when I upload it to my hosting server it doesn't work. Do I have to write some kind of connection string to the database and display code to display the contents of the database. If so where should I put the code. If someone could give me some info or examples it would be good. Thanks greatly appreciate your help.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-14-2008
Banned
 
Join Date: Oct 2007
Location: Hyderabad
Posts: 176
Thanks: 2
Thanked 11 Times in 11 Posts
quality_quantity is on a distinguished road
Re: Asp.net 2.0 page loaded from MS Access

Use this code my dear <%@ page language=vb debug=true %> <%@ import namespace="system.data" %> <%@ import namespace="system.data.oledb" %> <script runat=server> sub page_load(byval sender as object, byval e as eventargs) if not ispostback then dim dbconn as oledbconnection dim dbcommand as oledbdataadapter dim dspagedata as new dataset 'dbconn = new oledbconnection( _ ' "provider=microsoft.jet.oledb.4.0;" _ ' & "data source=" _ ' & server.mappath("employeedatabase.mdb;")) 'dbconn = new oledbconnection( _ ' "provider=microsoft.jet.oledb.4.0;" _ ' & "data source=" _ ' & "c:\inetpub\wwwroot\employeedatabase.mdb;") dbconn = new oledbconnection( _ "provider=microsoft.jet.oledb.4.0;" _ & "data source=" _ & mappath("employeedatabase.mdb;")) dbcommand = new oledbdataadapter _ ("select lastname & ', ' & firstname " _ & "as empname, id " _ & "from employee " _ & "order by lastname, firstname", dbconn) dbcommand.fill(dspagedata, _ "employee") ddlemps.datasource = _ dspagedata.tables("employee").defaultview ddlemps.databind() end if end sub </script> <html> <head> <title>connecting to an access database</title> </head> <body leftmargin="40"> <form runat="server"> <br><br> <asp:dropdownlist id="ddlemps" datatextfield="empname" datavaluefield="id" runat="server" /> </form> </body> </html>
Reply With Quote
Reply

  Geeks Talk > Web Development > ASP.NET


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Method to identify the loaded web page Geek_Guest QTP 1 12-21-2007 07:16 PM
Java Applet not loaded in Active Screen amni7303 QTP 0 11-14-2007 12:39 AM
Access Boss is a great access management and time control utility that allows you to JobHelper Geeks Lounge 0 07-22-2007 05:40 AM
I wish to add total number of records loaded N SRIRAM K Data Warehousing 0 06-23-2007 08:57 AM
Winrunner is taking the entire web page as a single page Sridevi.P WinRunner 0 06-05-2007 11:26 PM


All times are GMT -4. The time now is 07:11 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved