> with RS > .activeconnection=DBCONNECTION > .cursortype = adOpenStatic > .cursorlocation = adUseClient > .locktype = adLockOptimistic > .Source = "select * from users" > .open > end with >RS.AddNew >RS.FIELDS("F1")="XXX" >etc... >RS.UpDate>...and then I get that maddening "Multiple-step operation generated errors. " message and no idea why. Can somebody please tell me just how to use ADO to add new records to a VFP table. I don't think security is an issue here. "Everyone" has full access to folders and files. Thanks very much.
<% cSQLSelect = "select * from employee where !isnull(birth_date) and !isnull(hire_date)" cSQLInsert = "insert into employee (emp_id,First_name,last_name,hire_date) " &_ " values ('CBASOZ','Cetin','Basoz',date())" cSQLUpdate = "update testdata!employee " &_ "set " &_ "Birth_date = {^1961/01/19}, " & _ "Title = 'FoxyClasses Developer' " & _ "where emp_id = 'CBASOZ'" dbpath = Server.MapPath("data") set oConnection = Server.CreateObject( "adodb.connection" ) with oConnection .ConnectionString = "Provider=VFPOLEDB;data source=" & dbpath & "\testdata.dbc" .Open .Errors.Clear .Execute( "set null off" ) .Execute( cSQLInsert ) .Execute( cSQLUpdate ) Set rs = .Execute( cSQLSelect ) end with ' Check results Response.Write("<TABLE border='1'><TR><TD>Emp Id</TD>" & _ "<TD>First Name</TD><TD>Last Name</TD><TD>Title</TD><TD>Born</TD><TD>Hired</TD></TR>" ) while not rs.eof Response.Write("<TR>") Response.Write("<TD>" & rs.Fields("emp_id").value & "</TD>") Response.Write("<TD>" & rs.Fields("first_name").value & "</TD>") Response.Write("<TD>" & rs.Fields("last_name").value & "</TD>") Response.Write("<TD>" & rs.Fields("title").value & "</TD>") Response.Write("<TD>" & DatePart("yyyy",rs.Fields("birth_date").value) & "/" & _ DatePart("m",rs.Fields("birth_date").value) & "/" & _ DatePart("d",rs.Fields("birth_date").value) & "</TD>") Response.Write("<TD>" & rs.Fields("hire_date").value & "</TD>") Response.Write("</TR>") rs.MoveNext wend Response.Write("</TABLE><BR/>") ' cStoredProcCall = "myStoredProc('ReverseMe')" ' set rsc = oconnection.execute( cStoredProcCall ) ' response.write(rsc.fields(0).value) oConnection.Close set oConnection = nothing %>This is from another snippet that’s working:
lrs.AddNew lrs.Fields("emp_id").Value = "CBTEST" lrs.Fields("First_Name").Value = "cetin" lrs.Fields("Last_Name").Value = "basoz" lrs.Fields("hire_date").Value = #2004/01/13# lrs.UpdateBatchCetin