John W. Colby
jwcolby at colbyconsulting.com
Sun May 2 21:47:16 CDT 2004
Thanks Jim and Eric. In fact I found an entire chapter on the details of this in one of my .net books. Thanks again, John W. Colby www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Jim DeMarco Sent: Sunday, May 02, 2004 10:03 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] VB.Net John, Is this something like what you're looking for? It's some sample code I was playing with in ASP.NET. The connection (g_MyConn) is opened in the OpenConn() function. Other than that it should be pretty straight forward. Also you might add: Imports System.Data.OleDb at the top of your class module. Watch for wrapping and please note this is NOT a complete code sample. <snip> Dim sSQL As String Dim sHTML As String Dim cmd As OleDb.OleDbCommand Dim oDataReader As OleDb.OleDbDataReader sSQL = "SELECT MainMenuText, PageParam FROM tblPages WHERE MainMenuItem = True AND Active = True;" OpenConn() Try cmd = New OleDb.OleDbCommand(sSQL, g_MyConn) ' WHERE MainMenuItem = 1 AND Active = True oDataReader = cmd.ExecuteReader(CommandBehavior.Default) sHTML = "<table><tr>" & vbNewLine While oDataReader.Read sHTML = sHTML.Concat(sHTML, "<td><a href=" & Chr(34) & "PageMaster.aspx?page=" & oDataReader.GetValue(1) & Chr(34) & ">") sHTML = sHTML.Concat(sHTML, oDataReader.GetValue(0) & "</a></td>" & vbNewLine) End While Catch ex As Exception End Try </snip> HTH Jim DeMarco Director Application Development Hudson Health Plan -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Sunday, May 02, 2004 5:27 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] VB.Net yea, yea, yea. But you still need dim statements, you still need to set one to refer to the next to the next. Do you ever do this? John W. Colby www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Mike & Doris Manning Sent: Sunday, May 02, 2004 2:49 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] VB.Net VB.Net uses ADO in which you have a connection and command. You then use a dataset or datareader (forward only/read only) in place of a recordset. How you structure it via code all depends on whether you use OLE, ODBC, or SQLClient ADO providers. Doris Manning Database Administrator Hargrove Inc. www.hargroveinc.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, May 02, 2004 10:53 AM To: VBA Subject: [dba-VB] VB.Net I need to know the syntax for just setting up access to data from code. In DAO you just dimmed a db and a recordset: dim db as dao.database dim rst as dao.database set db = currentdb set rst = db.openrecordset() etc. I know there are three parts to vb.net and can set them up with the wizard, but I want to be able to "just do it" from code as well. Anyone know how? John W. Colby www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com **************************************************************************** ******* "This electronic message is intended to be for the use only of the named rec ipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". **************************************************************************** ******* _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com