•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,862 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,021 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 7009 | Replies: 2
![]() |
•
•
Join Date: Aug 2004
Posts: 22
Reputation:
Rep Power: 5
Solved Threads: 0
I'm trying to get started in ASP.NET, but I just don't understand the errors being returned to me. I'm trying to connect to my MySQL database. I have followed several examples from books and the internet with no success. Could someone look at my code and see if I'm screwing something up?
Also, how do you use the ****.vb file? I'm using VS.NET as my editor and if you hit F7 you can go to the ****.vb file, but if I place code in the Page_Load event it never runs..... ????
Any clues?????
Thanks in advance
- Eric
<%@ Import Namespace="System.Data.OleDB" %>
<%@ Import Namespace="System.Data" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default_page.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<%
'Put user code to initialize the page here
Dim dr As System.Data.OleDb.OleDbDataReader
Dim cn As System.Data.OleDb.OleDbConnection
Dim cmd As System.Data.OleDb.OleDbCommand
Dim cs As String
Dim SQL As String
cs = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=cashwell.no-ip.info;" & _
"DATABASE=Saphyre;" & _
"UID=WebTest;" & _
"Jet OLEDBatabase PASSWORD=asp-net;" & _
"OPTION=16427"
cn = New OleDbConnection(cs)
cn.Open()
SQL = "SELECT name FROM tbl_hosp;"
cmd = New OleDbCommand(SQL)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
%>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<meta content="VisualStudio.HTML" name="ProgId">
<meta content="Microsoft Visual Studio.NET 7.0" name="Originator">
</HEAD>
<body MS_POSITIONING="GridLayout">
<%
Response.Write(dr.GetString(0))
%>
</body>
</HTML>Also, how do you use the ****.vb file? I'm using VS.NET as my editor and if you hit F7 you can go to the ****.vb file, but if I place code in the Page_Load event it never runs..... ????
Any clues?????
Thanks in advance
- Eric
Try changing this line: cmd = New OleDbCommand(SQL) to this:
Also, your Page_Load event probably isn't working, because it's not wired up. Is there a 'Handles Page.Load' at the end of the declaration line?
cmd = New OleDbCommand(SQL,cn)
Also, your Page_Load event probably isn't working, because it's not wired up. Is there a 'Handles Page.Load' at the end of the declaration line?
-Ryan Hoffman
ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
•
•
Join Date: Aug 2004
Posts: 22
Reputation:
Rep Power: 5
Solved Threads: 0
I placed the connection object in the parameter as you instructed. I'm now getting a new error, "Could not find installable ISAM."
You can see the error at this address: http://www.derivetech.us/default_page.aspx
Any thoughts?
****.vb:
I did a search and could not find anywhere.
- Eric
You can see the error at this address: http://www.derivetech.us/default_page.aspx
Any thoughts?
****.vb:
I did a search and could not find
•
•
•
•
Handles Page.Load
- Eric
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- ~~ ASP.NET (VB) Help Needed ~~~ 10q (ASP.NET)
- ASP.NET Crystal Report ODBC MySQL (ASP.NET)
- Asp.net (ASP.NET)
- ASP.NET and Mozilla - Issues! (ASP.NET)
- ASP.NET <--> XML <--> VB6.0 (ASP.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Displaying pictures on Windows Forms using subprocedures in VB.NET
- Next Thread: How to sort the rows in the datagrid and update it successfully?


Linear Mode