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: 137
  • Last Modified:

Connecting to web Server

Hi all,

Can anyone tell me how to connect the vb application to a Database which is in the Web Server

For ex:

I insert some Data from my vb Application and the same should get inserted in the Database on the web Server

Pls help soon
1 Solution
in the connectionstring add 'Server=<SERVERNAME/SERVERIP>;' to connect to a web server database
What Database?

In VB its easily to connect to many Databases:

Sample for connection to a Text DB
Set oCN = CreateObject ("ADODB.Connection")
oCN.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\; extended properties=""text;HDR=YES;FMT=Delimited;separator="";"""""
Set oRs = CreateObject ("adodb.Recordset")

oRs.CursorType = 3 'adOpenStatic
oRs.LockType   = 3 'adlockoptimistic
strSQLStmt = " select * from 'Location of Your Databse'"
oRs.Open strSQLStmt, oCN

Now you can read and write with:
ORS("Fieldname")="Your Value"
VValue = ORS("Fieldname")

Connection for Access Database

Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='Your Database';"
Set Aprs = New Recordset
Aprs.Open "select * from 'YourTable' Where 'Your search'", db, adOpenStatic, adLockOptimistic

Éric MoreauSenior .Net ConsultantCommented:
is your database SQL server? in this case see "If connection to a remote server (via IP address):" from http://www.able-consulting.com/dotnet/adonet/Data_Providers.htm#SQLClientManagedProvider
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

jafariAuthor Commented:
Its ok,

But the Sql server on the web gives me permission to insert data from my stand alone vb application
Éric MoreauSenior .Net ConsultantCommented:
you need to connect using a User ID and a Passord.
jafariAuthor Commented:
friends i want to connect my application to the server in such a way that when the user inserts the Database name , the app should fire a query in which all the table names and their respective fields (with primary key, data type)  are displayed.

can u hep me
Éric MoreauSenior .Net ConsultantCommented:
select *
from sysobjects as so
inner join syscolumns as sc
on so.id = sc.id
where so.xtype = 'u'
Hi jafari,
It appears that you have forgotten to close this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept emoreau's comment(s) as an answer.

jafari, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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