iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Create Webpage with a recordset


Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2002, 04:09 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default Create Webpage with a recordset

Hey all

Basically at the momnt im doing a query on a database and im im using the returned recordset to print the results to a flexgrid.this is grand and it works fine.

But what i want to know is there anyway of using the recordset to create a webpage or some readonly format.

if you could start me off or give some links i would be greatfull

thanx
shane
__________________

"All i know is i don't know and i don't even know that!"
Reply With Quote
  #2  
Old 04-08-2002, 04:15 AM
VB_ACK
 
Posts: n/a
Default

Try this site: http://www.devguru.com/Technologies/...ado_intro.html

It deals with ASP syntax.
Reply With Quote
  #3  
Old 04-08-2002, 04:20 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default

does this mean i have to use asp to create the webpage.
how would i go about passing the recordset from my vb project to a recordset on a asp page.
__________________

"All i know is i don't know and i don't even know that!"
Reply With Quote
  #4  
Old 04-08-2002, 04:22 AM
VB_ACK
 
Posts: n/a
Default

There's a difference between Visual Basic and VBScript. They cannot work together as one language.

But passing the variables from one language to the other would be fundamentally simple.
Reply With Quote
  #5  
Old 04-08-2002, 04:28 AM
VB_ACK
 
Posts: n/a
Default

After reading through your posts once again I am bit confused as to what you are trying to accomplish.

Are you trying to open a recordset in ASP, or open a recordset in ASP using the recordset from your VB application?
Reply With Quote
  #6  
Old 04-08-2002, 04:52 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default

well if it is possible the later one.

i have a recordset in vb and im trying to create a web page with this recordset within the vb project.

i just want to know if this is possible

sorry for the confusion

thanx
shane
__________________

"All i know is i don't know and i don't even know that!"
Reply With Quote
  #7  
Old 04-08-2002, 05:06 AM
VB_ACK
 
Posts: n/a
Default

It certainly is.

You can modify strings to produce the proper syntax.

I haven't tried this out myself so be warned.

Code:
<%@ Language=VBScript %>

<%
Dim objConn
Dim objRecordset

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataBase.mdb"
objConnection.ConnectionTimeout = 0
objConn.Open

objRecordset.Open Select * FROM MyTable, objConn, , , adCmdTable

%>
That is how you would open a recordset in ASP.
Reply With Quote
  #8  
Old 04-08-2002, 05:14 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default

yeah i know how to open a recordset set in asp

you seem to misunderstand me


Code:
Dim cnAppsLog As Connection
    Set cnAppsLog = New Connection
    
    With cnAppsLog
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=sa;pwd=;" & "Data Source=IEDUBAS10;" & "Initial Catalog=AppsLog"
        .Open
    End With
    
    Set rsFirstRecord = New Recordset
    
    'FINDS THE RECORD OF THE PERSON WITH THE USERNAME AND PASSWORD THEY JUST ENTERED IN
    rsFirstRecord.Open "SELECT * FROM " & TableName & " WHERE Archive_Date = (SELECT MIN(Archive_Date) FROM " & TableName & ")", cnAppsLog

This is how i open my recordset.

Now i want to know is it possible using this recordset to create a webpage within visual basic and save it to a specific location.
__________________

"All i know is i don't know and i don't even know that!"
Reply With Quote
  #9  
Old 04-08-2002, 06:02 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul
Retired Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 17,226
Default

A webpage is just some text file with HTML in it.
If you know how to create a webpage by hand by just typing the right HTML tags, then it will be very easy.

Do you know anything about HTML?
__________________
I do not endorse any advertisements that appear in my contribution and detest their placement against my will.
Reply With Quote
  #10  
Old 04-08-2002, 06:08 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default

yeah im very familar with html and asp
just a newbe to vb

i think i found an easier way for the moment.

i now export the data to excel and save it as a web page
like this.

Code:
ExcelWS.SaveAs "G:\Information Technology\Development\Develop\Shane\Testing.htm", FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
But my problem is i want the user to be able to click on a button and the web page will open up from that directory.If its possible i would like to have the web paged maximized fully like when you press "F11"

thanx
shane
__________________

"All i know is i don't know and i don't even know that!"
Reply With Quote
  #11  
Old 04-08-2002, 06:35 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul
Retired Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 17,226
Default

Some untest code example to output the data of recordset as a html page.
Code:
Public Function Recordset2HTML(rstData As ADODB.Recordset, sFileName As String)
  Dim fID As Integer
  Dim i As Integer
  
  fID = FreeFile
  Open sFileName For Output As fID
    Print #fID, "<html><body>"
    Print #fID, "<table>"
    ' header row
    With rstData
      ' header columns
      Print #fID, "<tr>"
      For i = 0 To .Fields.Count - 1
        Print #fID, "<th>" & .Fields(i).Name & "</th>"
      Next i
      Print #fID, "</tr>"
      If Not .EOF Then
        .MoveFirst
        Do
          ' data
          Print #fID, "<tr>"
          For i = 0 To .Fields.Count - 1
            Print #fID, "<td>" & .Fields(i).Value & "</td>"
          Next i
          Print #fID, "</tr>"
          .MoveNext
        Loop Until .EOF
      End If
    End With
    Print #fID, "</table>"
    Print #fID, "</html>"
  Close fID

End Function
Use the ShellExecute API to open an existing HTML page, but I don't think you can simulate the F11 maximized state.
__________________
I do not endorse any advertisements that appear in my contribution and detest their placement against my will.
Reply With Quote
  #12  
Old 04-08-2002, 06:49 AM
Road Runner Road Runner is offline
Contributor
 
Join Date: Feb 2002
Location: Ireland
Posts: 444
Default

Thanx ArnoutV

just what i was looking for

I Had a question here but i figured it out
__________________

"All i know is i don't know and i don't even know that!"

Last edited by Road Runner : 04-08-2002 at 07:03 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Advertisement: