Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 802
  • Last Modified:

Connecting and manipulating remote database vb6 sql

Hello All

I am making a small game in vb6, now I want to have a highest score table included.  I want to have a database on my web space that holds the highest score table values.  I know the basics for entering and retrieving the values using sql.  

Basically what I need to know is how can I connect to the database on my web site and if so do I need to have any special features configured with my ISP who provide me with my web site space.

The code I use to alter and read from the database using sql is below

'Declaring your database
Public MyDatabase As ADODB.Connection

'Tables into your database
Public MyTable1 As ADODB.Recordset

Private Sub Form_Load()

'Set your variables to nothing (just for stability)
Set MyDatabase = Nothing
Set MyTable1 = Nothing

'Connecting to your DB
Set MyDatabase = New ADODB.Connection
Set MyTable1 = New ADODB.Recordset

'Here's where you're to set all your database options
ConnectionString = "Provider=SQLOLEDB.1" _
              & ";User ID=sa" _
              & ";Password=password" _
              & ";Initial Catalog=aTable" _
              & ";Data Source=mypc\SQLEXPRESS"

MyDatabase.Open ConnectionString
MyTable1.CursorLocation = adUseClient

'Insert into table
MyDatabase.Execute ("INSERT INTO Table_1 (name, address) VALUES ('new','value')")

'Delete from table, or to delete all use 'DELETE * FROM TableName'
MyDatabase.Execute ("DELETE  FROM Table_1 Where name='KJ'")
End Sub

I dont want to just show a web page with a list, I actually want to get the values from the aTable.mdf database held on my site and place them directly into my vb6 application.

I hope this makes sense


<password cleared by angelIII, zone advisor>
1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>I want to have a database on my web space
reading .mdf as file, this means sql server. for this to work, you web hosting needs to have sql server installed and configured for your use. is that the case?
if not, you cannot use ms sql server database to connect to.

SirNickAuthor Commented:
Thanks for your help...

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now