Connecting from an external VB program to MS SQL 2005 in discountasp.net

Discussion in 'Databases' started by eliaso, Jul 10, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I need to insert recoords from a program written in Visual Basic to a MS SQL 2005 Data Base in disacountasp.net so the website I have also hosted in discountasp.net will show this data. I'm trying to use the same connection string I use in my website and it works from my website (even ehrn I run my website locally in my machine but writing in the discountasp.net DB), howeverwhen I run my VB program I get an error:


    Err: -2147467259 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    I'm using the connection string:

    "Data Source=tcp:sql2k514.discountasp.net;Initial Catalog=.....

    Please do you know another option for the data source,maybe the ip or something else.

    Thanks,
    Elias
     
  2. Hi,
    To connect a VS VB appto a Data Server:
    1. Main menu in VS.
    2. Click on Data.
    3. Show Data Sources.
    4. Add New Data Source.
    5. When the Data Connection dialog opens add your DASP SQL Server, your username and password.
    6. Click to test the connection.
    7. Once it successfully connects click Next and name the new connection string.
    8. Once VB creates the conn string it will be stored in the app.config file.
     
  3. Thank you, but I'm using VB 6. Do you know how to do it with VB 6?





    Thanks,


    Eli
     
  4. Thanks I changed all the VB.NET.




    When I followed your instructions I got:


    <connectionStrings>


    <add name="AyeKa.My.MySettings.SQL2005_520083_teshConnectionString"


    connectionString="Data Source=sql2k514.discountasp.net;Initial Catalog=SQL2005_520083_XXXX;Persist Security Info=True;User ID=SQL2005_520083_tesh_user;Password=XXXXX"


    providerName="System.Data.SqlClient" />


    </connectionStrings>So in the program I'm using this connect string



    With oConn


    .ConnectionString = "Data Source=sql2k514.discountasp.net;Initial Catalog=SQL2005_520083_tesh;Persist Security Info=True;User ID=SQL2005_520083_XXXX;Password=XXXX"


    .Open()





    But I still get


    Err: -2147467259 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


    Can you help me?








    End With
     
  5. I was able to get it to work using the following:

    Global db As ADODB.Connection
    Set db = New ADODB.Connection
    On Error GoTo errorHandler
    db.Open 'Provider=sqloledb;Data Source=tcp:sql2k513.discountasp.net;Initial Catalog=myDASPCatalog;User ID=myDASPUsr;Password=myDASPPwd;'

    Hope this helps

    marc
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page