>>Set oConn = Server.CreateObject("ADODB.Connection") >>ConnStr = "Provider=VFPOLEDB;Data source=c:\inetpub\wwwroot\tip\login\data\tipdatabase.dbc" >>>>Cetin
>< % >Set oConn = Server.CreateObject("ADODB.Connection") >ConnStr = "Provider=VFPOLEDB;Data source=c:\inetpub\wwwroot\tip\login\data\tipdatabase.dbc" >oConn.Open ConnStr > >DIM SQL, oRS >SQL = "SELECT * FROM Users WHERE Username = '" & strUsername & "'" >Set oRS = Server.CreateObject("ADODB.Recordset") >oRS.Open SQL, oConn >% > >>I seems I need something more on the last line to deal with the buffering but I don't know what. The common tutorials use values like adOpenKeyset, adLockPessimistic, and adCmdText that don't seem to work with the VFP driver. Is there a tutorial available that is specific to the VFPOLEDB driver?
<% 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'" cStoredProcCall = "myStoredProc('ReverseMe')" 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/>") ' set rsc = oconnection.execute( cStoredProcCall ) ' response.write(rsc.fields(0).value) oConnection.Close set oConnection = nothing %>If you'd first get an RS and update it then the important setting is adUseClient:
oCon.ConnectionString = "Provider=VFPOLEDB;Data Source=blah blah\testdata.dbc" ' Alternative one at a time 'oCommand.CommandText = "insert into employee (emp_id,first_name,last_name,birth_date,notes)" & _ ' " values ('test3','First3','Last3',{^1961/1/19},?)" 'oCommand.CommandType = adCmdText 'Set oParm = oCommand.CreateParameter("Notes", adVarChar, adParamInput, Len(myMemo), myMemo) 'oCommand.Parameters.Append oParm 'oCon.Open 'oCon.Execute ("set null off") 'oCommand.ActiveConnection = oCon 'oCommand.Execute 'oCon.Close oCon.Mode = adModeShareDenyNone oCon.Open oCon.CursorLocation = adUseClient oCon.Execute ("set null off") oRS.Open "employee", oCon, adOpenKeyset, adLockBatchOptimistic, adCmdTable oRS.AddNew oRS.Fields("emp_id").Value = "test1" oRS.Fields("First_Name").Value = "First1" oRS.Fields("Last_Name").Value = "Last1" oRS.Fields("hire_date").Value = #1/13/2004# oRS.AddNew oRS.Fields("emp_id").Value = "test3" oRS.Fields("First_Name").Value = "First2" oRS.Fields("Last_Name").Value = "Last2" oRS.Fields("hire_date").Value = #2/29/2000# oRS.Fields("Notes").Value = myMemo oRS.UpdateBatch oRS.Close oCon.CloseAnd finally of course your internet account must have read and write access to tables.