Skip to content

Instantly share code, notes, and snippets.

@otkrsk
Created September 25, 2012 04:18
Show Gist options
  • Save otkrsk/3779957 to your computer and use it in GitHub Desktop.
Save otkrsk/3779957 to your computer and use it in GitHub Desktop.
Connecting to a database from classic ASP
Dim conn
Dim objRS
Dim cmd
Set conn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Command")
conn.Open "Provider=SQLOLEDB;Data Source=192.168.x.x;Initial Catalog=xxxxx;User Id=x;Password=xxxxxxxxxxxxxx"
Function InsertMO(ByVal StrDetail, ByVal TheTelco, ByVal ThePhone, ByVal TheSessionID, ByVal intkeywordid, ByVal intsessionid)
StrDetail = Replace(StrDetail,"|","-")
sqlInsert = "INSERT INTO InboxTbl (MobileNumber,KeywordId,Message,GUID,TelcoID,TransactionID) VALUES ('+6" & ThePhone & "'," & intkeywordid & ",'" & StrDetail & "','" & intsessionid & "'," & TheTelco & ",'" & TheSessionID & "')"
Set objRS = conn.Execute(sqlInsert)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment