Solved

Really 190 pts! - ftp info to ASP using VB 5.0

Posted on 1999-01-15
3
138 Views
Last Modified: 2013-12-25
ANSWER THIS AND I'LL GIVE YOU THE OTHER 120 POINTS ON ANOTHER QUESTION!
I designed a game in VB 5.0 that is to be distributed over the net. I'd like for the game to offer the option to post a "high score" in a small database table (or such) on the website. VB should link to the proper site, then add a record into a table (using ASP?), which ACCUMULTATES and sorts by high score, then nickname. How do you link to a site (ftp?), then add a record (using Active Server Pages)? I am open to an alternative method. This solution needs to work with Win95 in addition to Win98. PLEASE INCLUDE AS MUCH DETAIL AS YOU CAN WITH YOUR ANSWER, BECAUSE I'M NEW TO ASP AND "SPECIAL" VB CONTROLS.
0
Comment
Question by:tyroneb
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
MasseyM earned 70 total points
ID: 1830625
You do not need to use FTP.  YOu can do a very simple thing.  Within your code, write this VB procedure:

Dim success As Integer
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'------------------------------------------------------------------
 
'This elow shold be attached to a button command
Private Sub cmdWeb_Click()
Dim success As Integer
Site = "http://yoursitehere.com/postscore.asp?score=" & theirScore & "?nickname=" & Nickname
End If
success% = ShellToBrowser(Me, Site, 0)
End Sub

 
Function ShellToBrowser%(Frm As Form, ByVal URL$, ByVal WindowStyle%)
   
    Dim api%
        api% = ShellExecute(Frm.hwnd, "open", URL$, "", App.Path, WindowStyle%)
 
    'Check return value
    If api% < 31 Then
        'error code - see api help for more info
        MsgBox App.Title & " had a problem running your web browser.  You should check that your browser is correctly installed.(Error" & Format$(api%) & ")", 48, "Browser Unavailable"
        ShellToBrowser% = False
    ElseIf api% = 32 Then
        'no file association
        MsgBox App.Title & " could not find a file association for " & URL$ & " on your system. You should check that your browser is correctly installed and associated with this type of file.", 48, "Browser Unavailable"
        ShellToBrowser% = False
    Else
        'It worked!
        ShellToBrowser% = True
    End If
   
End Function
 

This will launch the browser and open the page called PostScore.asp.  It will ass the parameters called nickname and score.

In the ASP page, you would have something like this:

postscore.asp
-----------------
<!-- #Include File="TDSN.asp" -->
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open sDSN
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM Scores;"
RS.Open SQL, Conn, 3, 3
RS.AddNew
RS("Score") = Request.QueryString("Score")
RS("NickName") = Request.QueryString("nickname")
RS.Update
RS.Close
Conn.Close
Set RS = nothing
Set Conn = nothing
%>
<BODY>
YOUR HTML CODE HERE.
Thanks for your score.  It is posted in the database.  Click <A HREF="viewscores.asp">here</A> to view the top scores.


TDSN.ASP
-------------
<%
  sDB   = "databasename.mdb"
  sScriptDir = "virtual/path/to/database"
  sPath = Server.MapPath(sScriptDir) + "\"
  sDSN = "filedsn=" & sPath & "Score.dsn;DefaultDir=" & sPath & ";DBQ=" & sPath & sDB & ";"
%>

Score.dsn
--------------
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=512
ImplicitCommitSync=Yes
FIL=MS Access
DriverId=25

That should do it.  YOu will need an Access database that has a table called "SCORES" with a field called "NICKNAME" and another called "SCORE".  Create the files t hat I have listed above.  Fix the places you need to.  Then you are off.

YOu can email me at masseym@hotmail.com if you need more help.  Have fun and let me know where this site is so I can see it in action.
0
 

Author Comment

by:tyroneb
ID: 1830626
Fantastic! I've searched for the solution to this dilemna for three weeks. I will email you and discuss this further.
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1830627
Good deal.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now