AriOps Posted February 11, 2006 at 12:33 PM Report Share #13768 Posted February 11, 2006 at 12:33 PM Boas, Precisava de um exemplo de código em asp.net para ligar a uma base de dados em Access, sem DNS. Já pesquisei mas não consegui nada... Cumps. AriOps Artigo no Wiki Daniel Correia Link to comment Share on other sites More sharing options...
vbtipo Posted February 11, 2006 at 09:16 PM Report Share #13807 Posted February 11, 2006 at 09:16 PM 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 More sharing options...
_Pedro_ Posted February 22, 2006 at 09:51 PM Report Share #15018 Posted February 22, 2006 at 09:51 PM 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now