请问VB中如何写连接数据库的代码?sybase / oralce

解决方案 »

  1.   

    strConn ="Provider=sqloledb;Data Source=服务器名称;Initial Catalog=数据库名称;User Id=sa;Password=;"
      

  2.   

    上面的是sqlserver,这个是oralce
    Provider=MSDAORA.1;User ID=用户名;Data Source=数据库名;Persist Security Info=False
      

  3.   

    str ="Provider=sqloledb;Data Source=服务器名称;Initial Catalog=数据库名称;User Id=sa;Password=;"
      

  4.   

    Trusted Connection:
    "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;" 
    Adaptive Server Anywhere (ASA):"Provider=ASAProv;Data source=myASA" 
    Read more in the ASA User Guide >> 
     Adaptive Server Enterprise (ASE) with Data Source .IDS file:"Provider=Sybase ASE OLE DB Provider; Data source=myASE" 
    Note that you must create a Data Source .IDS file using the Sybase Data Administrator. These .IDS files resemble ODBC DSNs. 
     Adaptive Server Enterprise (ASE):"Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDBname;User Id=username;Password=password" 
       - some reports on problem using the above one, try the following as an alternative -"Provider=Sybase.ASEOLEDBProvider;Server Name=myASEserver,5000;Initial Catalog=myDBname;User Id=username;Password=password" 
    This one works only from Open Client 12.5 where the server port number feature works,燼llowing fully qualified connection strings to be used without defining燼ny .IDS Data Source files.
      

  5.   

    连oracle时:服务器是8.05,客户端如果是8.0没问题,如果是9.08.0这样能连
    cN.ConnectionString ="Provider=MSDAORA;Password=1;User ID=dbo;Data Source=ok"
    9.0需要这样才能连
    cN.ConnectionString="Provider=OraOLEDB.Oracle;User ID=dbo;Password=1;Data Source=ok"
    程序中如何能识别呢