|
 |
aspx_beginners thread: What's wrong with this code? Should be simple? Right?
Message #1 by "Barry Judson" <bwjudson@h...> on Tue, 12 Nov 2002 19:26:59
|
|
Anybody know what's wrong? Appreciate some help. No programming
experience! I really am green at this.
Most of the tutorials for stuff like this is in SQL server. Is there a
step by step anywhere for converting SQL to OLEDB anywhere? If I could
create the page in SQL and then convert to OLEDB, this would be helpful.
<%@ Import Namespace="System.Data.OLEDB" %>
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE
("g:\Combined Final.mdb");"
Dim strSQL as string ="select * from vernon_1993"
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Conn.Open()
myDataGrid.DataSource = Cmd.ExecuteReader
(system.data.CommandBehavior.CloseConnection)
myDataGrid.DataBind()
End Sub
</script>
<html><head>
<title>Vernon River 1993</title>
</head>
<body bgcolor="#FFFFFF">
<font face="Verdana"><h3>Vernon River 1993</h3></font>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="100%"
BackColor="white"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
Headerstyle-BackColor="lightblue"
Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold"
MaintainState="false"
/>
</body></html>
Message #2 by "Jack" <jdunstan7@h...> on Tue, 12 Nov 2002 21:25:29 -0500
|
|
Barry,
I ran it like shown below, did you try it this way:
Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=g:\Combined Final.mdb;"
if that doesn't help, let us know what error you are getting.
Jack
----- Original Message -----
From: Barry Judson
To: aspx_beginners
Sent: Tuesday, November 12, 2002 7:26 PM
Subject: [aspx_beginners] What's wrong with this code? Should be simple? Right?
Anybody know what's wrong? Appreciate some help. No programming
experience! I really am green at this.
Most of the tutorials for stuff like this is in SQL server. Is there a
step by step anywhere for converting SQL to OLEDB anywhere? If I could
create the page in SQL and then convert to OLEDB, this would be helpful.
<%@ Import Namespace="System.Data.OLEDB" %>
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE
("g:\Combined Final.mdb");"
Dim strSQL as string ="select * from vernon_1993"
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Conn.Open()
myDataGrid.DataSource = Cmd.ExecuteReader
(system.data.CommandBehavior.CloseConnection)
myDataGrid.DataBind()
End Sub
</script>
<html><head>
<title>Vernon River 1993</title>
</head>
<body bgcolor="#FFFFFF">
<font face="Verdana"><h3>Vernon River 1993</h3></font>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="100%"
BackColor="white"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
Headerstyle-BackColor="lightblue"
Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold"
MaintainState="false"
/>
</body></html>
Message #3 by "Ken Schaefer" <ken@a...> on Wed, 13 Nov 2002 13:46:10 +1100
|
|
You could start by telling us what the error is... :-)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Barry Judson" <bwjudson@h...>
Subject: [aspx_beginners] What's wrong with this code? Should be simple?
Right?
: Anybody know what's wrong? Appreciate some help. No programming
: experience! I really am green at this.
: Most of the tutorials for stuff like this is in SQL server. Is there a
: step by step anywhere for converting SQL to OLEDB anywhere? If I could
: create the page in SQL and then convert to OLEDB, this would be helpful.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |