[Newbe] Help needed.
Posted: 01.06.2008, 13:48
Hi there.
I just started to use ZeosLib so I'll have to ask for your patience
Here's the thing: I'm using ZEOSLIB_TESTING_REV368 with LAZARUS 0.9.24 beta and I have to write a console application with these two. The program should read an sql query from a text file and execute it on first MSSQL server, then it has to write an INSERT statement (filled with earlier query results) and throw it to another MSSQL DB. My problem is that since I don't know the exact structure of insert statement, I have to count columns in query result, and IZResultSet doesn't have that functionality. I decided to write a few lines of code to do that and there they go:
But even that simple piece of code gets crashed and I'm unable to read the right columns count. This crashes after 2 iterations and returns "Access Violation" exception.
I thought it maybe something with the GetBoolean function so I changed it to IsNull(ColIndex), but then I recevied "Row buffer is not assigned" exception.
Please help me with this one.
P.S. Maybe I should mention my sql query used for testing: "SELECT * FROM my_table;". This table has 5 columns.
P.S.2 Sorry for my english (most likely I have done some language mistakes).
I just started to use ZeosLib so I'll have to ask for your patience
Here's the thing: I'm using ZEOSLIB_TESTING_REV368 with LAZARUS 0.9.24 beta and I have to write a console application with these two. The program should read an sql query from a text file and execute it on first MSSQL server, then it has to write an INSERT statement (filled with earlier query results) and throw it to another MSSQL DB. My problem is that since I don't know the exact structure of insert statement, I have to count columns in query result, and IZResultSet doesn't have that functionality. I decided to write a few lines of code to do that and there they go:
Code: Select all
col := 1;
cond := True;
while cond do begin
try
RS.GetBoolean(col);
except
on E : Exception do
cond := False;
end;
col := col+1;
end;
I thought it maybe something with the GetBoolean function so I changed it to IsNull(ColIndex), but then I recevied "Row buffer is not assigned" exception.
Please help me with this one.
P.S. Maybe I should mention my sql query used for testing: "SELECT * FROM my_table;". This table has 5 columns.
P.S.2 Sorry for my english (most likely I have done some language mistakes).