Does anyone know how to get the contents of a General field in a Foxpro table, into a SQL table using SQL Passthrough?
In this case, I've got an MS graph in the General field of a foxpro cursor. The foxpro cursor has 4 columns, as follows:
iPK - int
cName - c(20)
cdesc - c(100)
oGraph - General
Then I have a SQL table, called tblUserGraphs, with a similiar structure:
iPK - int
cName - c(20)
cdesc - c(100)
oGraph - image
At run time, the fox cursor, called "csrTemp", has the values and the graph that I need to get to SQL. I want to be able to do something like:
Of course the statement returns a -1, and when looking at the SQL Statement passed to SQL via SQL Profiler, it looks like this:
So obviously that wasn't working. To see if this was even possible, I tried it using a VFP Remote View and TableUpdate, and that did work. In that case, the SQL Statement passed to SQL came over as:
(Note that for the sake of not making things more convoluted here, I truncated that 2nd Value in that INSERT statement. Where it says "0x151C32...", the actual value SQL received began with those 69 characters, but carried on to be 11,748 characters!!!)
So this told me that VFP does in fact know how to pass graphs in a General field to SQL, and SQL can receive them. But what the hell are those 11,748 characters, and how do I get them. Apparently they represent the graph. Just to make sure it worked, I pulled the data from that SQL table back into a different VFP cursor, and the graph was still in tact and editable. Are those 11,748 characters the hexidecimal representation of the graph?
Any ideas on how to make this work would make myself and my clients very happy!
Thanks,
Dan
In this case, I've got an MS graph in the General field of a foxpro cursor. The foxpro cursor has 4 columns, as follows:
iPK - int
cName - c(20)
cdesc - c(100)
oGraph - General
Then I have a SQL table, called tblUserGraphs, with a similiar structure:
iPK - int
cName - c(20)
cdesc - c(100)
oGraph - image
At run time, the fox cursor, called "csrTemp", has the values and the graph that I need to get to SQL. I want to be able to do something like:
Code:
lcSql = [INSERT INTO tblUserGraphs VALUES (] + ;
TRANSFORM(liNextID) + [, '] + ;
csrTemp.cName + [', '] + ;
csrTemp.cDesc + [', ] + ;
csrTemp.oGraph )]
lnResult = SQLEXEC(lnConn, lcSql)
Of course the statement returns a -1, and when looking at the SQL Statement passed to SQL via SQL Profiler, it looks like this:
Code:
INSERT INTO tblUserGraphs values ( 9, Gen, 'name9', 'desc9')
So obviously that wasn't working. To see if this was even possible, I tried it using a VFP Remote View and TableUpdate, and that did work. In that case, the SQL Statement passed to SQL came over as:
Code:
INSERT INTO dbo.visiongraphs (olegraph,cName,cdesc) VALUES (9, 0x151C3200020000000E001000140022003F03ABFD56697375616C20466F7850726F0..., 'name9','desc9')
(Note that for the sake of not making things more convoluted here, I truncated that 2nd Value in that INSERT statement. Where it says "0x151C32...", the actual value SQL received began with those 69 characters, but carried on to be 11,748 characters!!!)
So this told me that VFP does in fact know how to pass graphs in a General field to SQL, and SQL can receive them. But what the hell are those 11,748 characters, and how do I get them. Apparently they represent the graph. Just to make sure it worked, I pulled the data from that SQL table back into a different VFP cursor, and the graph was still in tact and editable. Are those 11,748 characters the hexidecimal representation of the graph?
Any ideas on how to make this work would make myself and my clients very happy!
Thanks,
Dan