PDA

View Full Version : OLEDB INSERT


alvin616
06-06-2008, 04:43 AM
hi
THis is ODBC insert code, how to chnage to OLEDB Thnaks.




' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

wisemx
06-06-2008, 10:06 AM
This is some recordset code I used here more than a year ago for some ASP DB pages:


[quote]

dim TheName, admPassword, dbTypeShout, sqlDatabaseFileShout, sqlDatabaseShout, sqlUsernameShout, sqlPasswordShout, sqlPortShout, sqlServerShout
'****************************************
admPassword = "passwordhere"
dbTypeShout = 1
sqlDatabaseFileShout = "/data/shoutbox.mdb"
'****************************************
dim boxTemplate, boxName, boxMessage
dim boxSQL, boxCon, boxRS
set boxCon = Server.CreateObject("ADODB.Connection")
set boxRS = Server.CreateObject("ADODB.Recordset")
boxCon.Open "Provider=SQLOLEDB;Data Source=server.discountasp.net;database=wisemxdnb;u id=wisemx_user;pwd=passwordhere;"
if(instr(lcase(Request.ServerVariables("QUERY_STRING")), lcase("initsql")) > 0) then
boxSQL = "CREATE TABLE [shoutbox] ("
boxSQL = boxSQL + "[id] AUTOINCREMENT PRIMARY KEY ,"
boxSQL = boxSQL + "[name] VARCHAR(50) NOT NULL ,"
boxSQL = boxSQL + "[message] VARCHAR(250) NOT NULL ,"
boxSQL = boxSQL + "[date] VARCHAR(25) NOT NULL ,"
boxSQL = boxSQL + "[ip] VARCHAR(16) NOT NULL "
boxSQL = boxSQL + ");"
boxCon.Execute(boxSQL)</CODE>