asp ADO connection Microsoft VBScript runtime error '800a01a8'

aliessyInsake

New Member
dear all pro programmer here, im totally new in here, and i might dont know how to correctly as a question here..if i may ask for help, could u pls here here here...im having problem with simple asp with oop structure... help me with function savedata pls. when run, \[code\]call savedata("insert","test_","name, id","lalala, 222","User_ID=3")\[/code\]got error : INSERT INTO test_ (name, id) VALUES (lalala, 222) ... Microsoft VBScript runtime error '800a01a8' Object required: 'Conn' \[code\]<%function declare_conn(sql,atr)dim conn, conn_set conn = Server.CreateObject("ADODB.Connection")conn = Connect()set conn_ = Server.CreateObject("ADODB.Recordset")strConnect = _T("Driver={MySQL ODBC 3.51 Driver};Server=localhost;" "Database=MyDatabase;User=MyUserName;Password=MyPassword;Option=4;");if Cstr(atr)="open" then conn_.CursorLocation = adUseClient conn_.Open sql, conn, 3, 2 set conn_.ActiveConnection = nothing set declare_conn=conn_else if Cstr(atr)="exec" then conn.Open conn.Execute sql end ifend ifend functionfunction calldata(a,b,c,d)dim conn_string, sql_string if c<>"" and d<>"" then sql_string="SELECT "&Cstr(a)&" FROM "&Cstr(b)&" WHERE "&Cstr(c)&" = '"&Cstr(d)&"'" response.write(sql_string) else sql_string="SELECT "&Cstr(a)&" FROM "&Cstr(b) response.write(sql_string) end ifset conn_string = Server.CreateObject("ADODB.Recordset")set conn_string = declare_conn(sql_string,"open")set calldata = http://stackoverflow.com/questions/15757839/conn_stringend functionfunction savedata(a,b,c,d,e)dim conn_string, sql_string, c_, d_, update_stringupdate_string ="" if Cstr(a)="insert" then sql_string="INSERT INTO "&Cstr(b)&" ("&Cstr(c)&") VALUES ("&Cstr(d)&")" end if response.write(sql_string) 'response.end if Cstr(a)="update" then c_ = split(c,", ",-1) d_ = split(d,", ",-1) response.write(c_) response.end if ubound(c_) = ubound(d_) then do while not c_.eof update_string=update_string&"("&Cstr(c_)&"="&Cstr(d_)&")," c_.MoveNext : d_.MoveNext loop else %><script type="text/javascript">alert("save function error: array out of bound");</script> <% end if if Cstr(e)<>"" then sql_string="UPDATE "&Cstr(b)&" SET "&update_string&" WHERE "&Cstr(e) else sql_string="UPDATE "&Cstr(b)&" SET "&update_string end if end if'set conn_string = Server.CreateObject("ADODB.Recordset")call declare_conn(sql_string,"exec")end function%>\[/code\]wht is tht error actually mean? i create a connection to database ADO in \[code\]connect()\[/code\]still, i can run without problem for \[code\]calldata()\[/code\]
 
Top