Good Day,
Just want to ask some help please, currently I'm using MS Access as my database but now I would like to use SQL DB as my database. Could anyone help me how to convert my connection string from ms access to sql db. below is my connection on ms access please do modification to work it on SQL. Many thanks in advance.
Just want to ask some help please, currently I'm using MS Access as my database but now I would like to use SQL DB as my database. Could anyone help me how to convert my connection string from ms access to sql db. below is my connection on ms access please do modification to work it on SQL. Many thanks in advance.
Code:
<%
dim strConn
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& server.MapPath("bts_db.mdb") &";Persist Security Info=False;Jet OLEDB:Database Password = prs"
function get_recordset(byval strSQL, byref recset)
on error resume next
set recset = Server.CreateObject("ADODB.Recordset")
recset.open strSQL, strConn, 3
if err.number <> 0 then
Response.Write err.Description & "<br>"
Response.Write err.Source & "<br>"
Response.Write strSQL
Response.End
end if
get_recordset = recset.recordcount
end function
sub Execute_Query (byval strSQL)
on error resume next
dim con
Set con = Server.CreateObject("adodb.Connection")
con.open strConn
con.BeginTrans
con.execute strSQL
if err.number <> 0 then
Response.Write err.Description & "<br>"
Response.Write err.Source & "<br>"
Response.Write strSQL & "<br>"
Response.End
con.RollbackTrans
else
con.CommitTrans
end if
Set con = nothing
end sub
%>
Comment