Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDB Update Memo Large Size Not Working
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00681778
Message ID:
00681813
Views:
49
Got it. It looks like the cursor types and lock types
are all different when using the OLEDB driver compared
to using the old ODBC driver. In case anyone needs
this, here is how to do it.

Again, the only reason I am messing with an ADO recordset
is because I have a memo column with more than 255 bytes
in it, and the OLEDB driver won't take that for a SQL-Insert.
In addition, setting a value in the recordset straight
doesn't work either, have to use the ADO AppendChunk method.

This .asp page creates a database and a dummy table.
Wrap it in ASP tags and save it as oledb1.asp
cDestDir = "c:\"
cDestDBC = "mydbc.dbc"
Set oCat = CreateObject("ADOX.Catalog.2.7")
oCat.Create "Provider=VFPOLEDB.1;Data Source=" & cDestDir & cDestDBC
Set oConn = CreateObject("ADODB.Connection.2.7")
With oConn
.ConnectionString = _
	"Provider=VFPOLEDB.1;Data Source=" & cDestDir & cDestDBC
.CursorLocation = 2	'	adUseServer
.Mode = 16			'	adModeShareDenyNone
.Open
End With
'	When creating a table, always do it with a column 
'	called "CreateDate", it doesn't get in
'	the way of any other code you are going to 
'	do and you will always know when a row was
'	first created with it.  Then add the actual 
'	columns you need with ALTER TABLE statements.
oConn.Execute("Create Table " & cDestDir & "ShowF2 ( tCreateDt t(8) Null Default DateTime() )")
oConn.Execute("Alter Table ShowF2 Add Column cShowID c(30) Null ")
oConn.Execute("Alter Table ShowF2 Add Column mDescript m Null")
oConn.Execute("Alter Table ShowF2 Add Column climitations c(239) ")
oConn.Execute("Insert Into ShowF2(cShowID) Values('4')")
Set oConn = Nothing
And this does the actual AppendChunk work.
Wrap it in ASP tags and save it as oledb2.asp
cTxtShowID = 4
cTxtDescription = String(2560,"x")
cDestDir = "c:\"
cDestDBC = "mydbc.dbc"
Set oConn = CreateObject("ADODB.Connection.2.7")
With oConn
	.ConnectionString = "Provider=VFPOLEDB.1;Data Source=" & cDestDir & cDestDBC
	.CursorLocation = 2
	.Mode = 16
	.Open
End With
Set oRS = CreateObject("ADODB.RecordSet.2.7")
oRs.cursortype = 1
oRs.cursorlocation = 3
oRs.locktype = 3
cSQL = "Select cShowID , mDescript , tCreateDt , cLimitations from ShowF2 Where cShowID = '" & cTxtShowID & "'"
oRS.Open cSQL , oConn
For iCnt = 0 To oRS.Fields.Count - 1
	Response.Write oRS(iCnt).Name & "<br/>" & vbCRLF
	Response.Write oRS(iCnt) & "<br/>" & vbCRLF
	Response.Write "-------------------" & "<br/>" & vbCRLF
Next
oRS.Fields("cLimitations") = "None"
oRS.Update
iChunk = 254
For iNo = 1 to len(cTxtDescription) step iChunk
	iStartAt = iNo
	cWorkString = mid(cTxtDescription, iStartAt , iChunk )
	Response.Write "At byte " & iNo & vbCRLF &  "<br/>"
	oRs.Fields("mDescript").AppendChunk(cWorkString)
Next
Response.Write "<br/><br/> Adding a null on the end, probably not "
Response.Write "needed but leave it there for future.<br/>" & vbCRLF
oRS("mDescript").AppendChunk( ChrB(0) )
Response.Write "Flush recordset to disk.<br/>"
oRS.Update
oRS.Close
Set oRS = Nothing
Set oConn = Nothing
Thanks for reading this far!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform