|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Mysql delphi problem ?? Ado ??
Hi, i´m new around here and have this big problem to solve.
The fact is that i´m using Delphi 7 + Ado + MyODBC 3.51 and Mysql 4.1 and someting strange is happening. The code i´m going to write down works perfectly with SQL Server 2000. The fact is that if i acessed the same ado query previously it gives me the error "acess violation at address 1F45E7E in module 'msado15.dll'. write of address 01134010 ". let me explain better: If I change the first ADOQuery for another with a different name, like ADOQtest (and put a adoq test on the form), the code works perfectly, but if i let like it is below, gives that error. procedure TfrmPrincipal.Button3Click(Sender: TObject); var ultimo:integer; begin with ADOQenvelope do begin Close; sql.Clear; sql.Add('select * from envelope order by enve_id'); Open; Last; ultimo:=ADOQenvelope.fieldbyname('enve_id').asinteger+1; showmessage(inttostr(ultimo)); end; with ADOQenvelope do begin close; sql.clear; sql.add('insert into envelope'); sql.add(' (enve_id,usu_id_envelope, enve_regirregulares,enve_reginformados,enve_regdigitalizados)'); sql.add(' values (:cod,:velope,:irreg,:infor,:digitali)'); Parameters.ParamByName('cod').value:=ultimo; Parameters.ParamByName('velope').Value:=strtoint(EDusuid.text); Parameters.ParamByName('irreg').Value:=strtoint(Edregirregu.text); Parameters.ParamByName('infor').Value:=12; Parameters.ParamByName('digitali').Value:=12; ExecSQL; end; end; Seems like i can use a query only one time....And every time i try to do a different "action" with a previously used query, it hangs.. Select works fine, but, if i use this adoquery before just to do a select, like above, it gives that error. Can someone help me? It´s a Mysql problem? Ado ? |
|
#2
|
||||
|
||||
|
Sounds like a MyODBC problem to me. BTW there are some known issues and workarounds. See
http://dev.mysql.com/doc/mysql/en/P...ith_MyODBC.html
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#3
|
|||
|
|||
|
I solved the problem in a very unusual way...
every time i want to insert data in a database, first i use this: adoconnect.connected:=false; and then adoconnect.connected:=true; .... insert into .... and works... don´t ask me why !!!! |
|
#4
|
|||
|
|||
|
INSTEAD OF disconnecting & connecting every time,
try using a ADOCommand Component instead of ADOQuery. It will work fine. If you disconnect & connect everytime, the operations will become slow. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > Mysql delphi problem ?? Ado ?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|