Jump to content

Ligar a uma BD Access


AriOps
 Share

Recommended Posts

dim conn, rs
   Set conn = Server.CreateObject("ADODB.Connection")
   conn.open ("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=O caminho completo para a tua base de dados")
   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.open "Select * from tabela",fp_conn

Ps: Se alguém saber doutra maneira mais eficaz avissem

Lema: Se eu não saber de alguma coisa não se preocupem porque tento sempre ajudar alguma coisita, nem que seja, por palpites/sugestões.

Link to comment
Share on other sites

using System;
using System.Data.OleDb;

public class DAL
   {
       public static string DbName = "basedados.mdb";
       public static string DbPathName;
       private static string StrConn1 = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
       private static string StrConn;        // StrConn = StrConn1 + DbPathName
       private static OleDbConnection Conn;
       private static OleDbCommand Cmd;
       private static OleDbDataReader DtReader;
       //public static string utilizador;

       public DAL()
       {
           //
           // TODO: Add constructor logic here
           //
       }

       public static void GetConnection()
       {
           if (StrConn == null) StrConn = StrConn1 + DbPathName;
           // Conn= new OleDbConnection(StrConn);
           Conn = new OleDbConnection();
           Conn.ConnectionString= StrConn;
           Conn.Open();
       }

       public static void CloseConnection()
       {
           DtReader.Close();
           Conn.Close();   
       }

       public static OleDbConnection GetObjConn() 
       { 
           return Conn; 
       }
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.