Hello,
Just registered here so hi to all!
I want to (re)create a connection function for MsAccess.
I'm a ASP programmer too and this is my old function:
With that function, in ASP, I can use correctly the addnew(), delete() and update() correctly.
Here an example:
I've tried to modify my function for vb.net
With that function for vb.net I can write records correctly, but if I want to reads records, I got an error for ArgumentException.
Please can you help me?
Thank you very much.
Just registered here so hi to all!
I want to (re)create a connection function for MsAccess.
I'm a ASP programmer too and this is my old function:
VB.NET:
function Connettore_NG(mdb,SQL)
dim NG_Connessione, stringa_connessione, NG_rs, file_fisico
file_fisico = server.MapPath(cartella_mdb & mdb & ".mdb")
Set NG_Connessione = Server.CreateObject("ADODB.Connection")
stringa_connessione ="driver={Microsoft Access Driver (*.mdb)}; DBQ=" & file_fisico
NG_Connessione.Open stringa_connessione
Set NG_rs = Server.CreateObject("ADODB.Recordset")
NG_rs.Open SQL, NG_Connessione ,3,3
set Connettore_NG = NG_RS
set NG_Connessione = Nothing
end function
With that function, in ASP, I can use correctly the addnew(), delete() and update() correctly.
Here an example:
VB.NET:
set rs = connettore_NG("fileaccess","select * from table1")
rs.addnew
rs("field1") = "hi folks"
rs("field2") = "regards"
rs.update
I've tried to modify my function for vb.net
VB.NET:
Public Function Connettore_NG(mdb, SQL)
Dim NG_Connessione, stringa_connessione, NG_rs
NG_Connessione = CreateObject("ADODB.Connection")
stringa_connessione = "driver={Microsoft Access Driver (*.mdb)}; DBQ=" & mdb
NG_Connessione.Open(stringa_connessione)
NG_rs = CreateObject("ADODB.Recordset")
NG_rs.Open(SQL, NG_Connessione, 3, 3)
Connettore_NG = NG_rs
NG_Connessione = Nothing
End Function
With that function for vb.net I can write records correctly, but if I want to reads records, I got an error for ArgumentException.
Please can you help me?
Thank you very much.