Forum Moderators: open

Message Too Old, No Replies

Help Needed

need help to access database

         

brettski

9:03 pm on Dec 16, 2003 (gmt 0)

10+ Year Member



Im having no joy trying to figure out this problem of my localhost not displaying any data from my access database.

Could someone please give me any tips as to what may be causeing the problem.

THE asp page loads fine but no data gets displayed, and no error message, is there something blocking this data from being fed through to the page?

any help would be great as Im not making any progress

wackal

11:34 pm on Dec 16, 2003 (gmt 0)

10+ Year Member



could you post your code?

brettski

3:57 am on Dec 17, 2003 (gmt 0)

10+ Year Member



<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" runat="server">
sub Page_Load(Sender as Object, e as EventArgs)
'set up connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\db\banking.mdb")

'open connection
dim objCmd as OleDbDataAdapter = new OleDbDataAdapter _
("select * from tblUsers", objConn)

'fill dataset
dim ds as DataSet = new DataSet()
objCmd.Fill(ds, "tblUsers")

'select data view and bind to server control
MyDataList.DataSource = ds.Tables("tblUsers"). _
DefaultView
MyDataList.DataBind()
end sub
</script>

<html><body>
<ASP:DataList id="MyDataList" RepeatColumns="2"
RepeatDirection="Vertical" runat="server">
<ItemTemplate>
<div style="padding:15,15,15,15;font-size:10pt;
font-family:Verdana">
<div style="font:12pt verdana;color:darkred">
<i><b><%# DataBinder.Eval(Container.DataItem, "FirstName")%>&nbsp;
<%# DataBinder.Eval(Container.DataItem, "LastName")%>
</i></b>
</div>
<br>
<b>Address: </b><%# DataBinder.Eval(Container.DataItem, _
"Address") %><br>
<b>City: </b><%# DataBinder.Eval(Container.DataItem, _
"City")%><br>
<b>State: </b><%# DataBinder.Eval _
(Container.DataItem, "State") %><br>
<b>ZIP: </b><%# DataBinder.Eval _
(Container.DataItem, "Zip") %><br>
<b>Phone: </b><%# DataBinder.Eval _
(Container.DataItem, "Phone") %><br>
</div>
</ItemTemplate>
</ASP:DataList>
</body></html>

heres the code , very simple, cant get it to work though, it loads, as in the HTML anyway, but thats it.

duckhunter

4:00 am on Dec 17, 2003 (gmt 0)

10+ Year Member



Believe you need a objConn.Open statement before you can execute SQL against it.

brettski

4:23 am on Dec 17, 2003 (gmt 0)

10+ Year Member




objConn.Open()
dim objCmd as OleDbDataAdapter = new OleDbDataAdapter _
("select * from tblUsers", objConn)

Yes I just tried what you said, still nothing though.

tomasz

2:30 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



try this

MyDataList.DataSource = ds.Tables(0).DefaultView

brettski

2:49 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



sorry that doesnt work either.

I dont know if its the code, I mean Ive tried using code written by pro's and that doesnt work either, I really think that something is blocking my database connection alltogether.

I have looked at the security settings for local, but I have no idea where to start when configing them,
Someone suggested that the port my database was communicating through may be being used by something else,,

Does this sound familiar to anyone?

It all started after installing the IE security update from microsoft.

Im very appreciative of all your help by the way, thanks

macrost

3:25 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



objConn.Open()
dim objCmd as OleDbDataAdapter = new OleDbDataAdapter _
("select * from tblUsers", objConn)

Was your objConn.Open() like this?

objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db\banking.mdb")

brettski

3:52 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



I tested this page

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>This page was created at <b>
<%= Time %>
</b> on the computer running ASP.</p>
</body>
</html>

and no asp processing seems to be happeing here is the result:

"This page was created at on the computer running ASP."

It displays the html , but not the asp

Does this help?

Man It sux being a noobie.

macrost

4:09 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



I know this might sound stupid, but do a look here for the asp.dll file: (your drive):\winnt\system32

brettski

6:33 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



yes i found it under c:\windows\system32\inetsrv

macrost

6:46 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



Well if your computer won't even process simple code like:

<html>
<body>
<%response.write("Hello World!")%>
</body>
</html>

Then I think it's time to reinstall IIS.
Mac

brettski

6:57 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



ok thanks, ill try that

brettski

7:18 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



I reinstalled IIS server, as an Microsoft Engineer asked.

I tried this code

<p>This page was created at <b>
<% Response.Write("Hello World!")%>
</b> on the computer running ASP.</p>

no asp gets dispalyed, the html is fine, man this sux

any ideas?

TheNige

8:16 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



try running aspnet_regiis.exe from the command prompt. It is located in your .Net framework directory. This links the framework up with IIS.

wackal

8:38 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



what extension are you saving the files under? For .NET you need to use .aspx

brettski

8:39 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



YO MAN you got IT!

THANKS so much , words cant tell you how gratefull I am,
5 days spent on this problem, nearly drove me insane

I never would have thought of that.

My first name is Nigel by the way.

To all others who helped too, thankyou very much also, you guys are a huge help, I was almost gana pay microsoft to help me out i was that desperate.

thanks again
brett

TheNige

9:11 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



So was it the .aspx extension?

wackal

6:16 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



glad we could be of help. Goold luck with everything Nigel. BTW, my name is Al.