Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1999-01-15
3
Medium Priority
?
147 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 280 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

773 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