List:MySQL and .NET« Previous MessageNext Message »
From:Jorge Bastos Date:November 22 2004 11:05am
Subject:Re: get error
View as plain text  
Ok, i found it, what i wanted was this:
Because the table name "tbl" doesn't exist MySqlExeption is goint to return 
the mysql error number 1146 that is the error number for non existing tables

Dim c As New param

MyCon = New MySqlConnection(c.LerMy)

MyCon.Open()

MyCmd = New MySqlCommand("select * from tbl", MyCon)

Try

MyCmd.ExecuteNonQuery()

Catch ex As MySqlException

MsgBox(ex.Number)

End Try

MyCon.Close()



----- Original Message ----- 
From: "Jorge Bastos" <mysql.jorge@stripped>
To: <dotnet@stripped>
Sent: Monday, November 22, 2004 10:05 AM
Subject: Re: get error


> In in other way,
>
> I'm not saying that this is an error, i just want to catch it.
>
>
> ----- Original Message ----- 
> From: "Patrick Questembert" <patrickq@stripped>
> To: "Jorge Bastos" <mysql.jorge@stripped>; <dotnet@stripped>
> Sent: Sunday, November 21, 2004 10:32 PM
> Subject: RE: get error
>
>
>> Maybe you didn't see an error in the first case because whatever happened
>> was treated as a warning.
>> did you try:
>> SHOW WARNINGS;
>>
>> This will show you the warnings associated with the last statement 
>> executed
>> (MySQL 4.10 and above).
>>
>> -----Original Message-----
>> From: Jorge Bastos [mailto:mysql.jorge@stripped]
>> Sent: Sunday, November 21, 2004 5:26 PM
>> To: dotnet@stripped
>> Subject: get error
>>
>>
>> Reggie or mailling list,
>>
>> I have a question, is it possible to retrieve the error number from 
>> mysql,
>> for example like this:
>>
>> mysql> create table xx (i int(1));
>> Query OK, 0 rows affected (0.16 sec)
>>
>> mysql> create table xx (i int(1));
>> ERROR 1050: Table 'xx' already exists
>>
>> For the table exists i have the error number 1050.
>> Can i get that number some how?
>>
>> Jorge Bastos
>>
>>
>> -- 
>> MySQL on .NET Mailing List
>> For list archives: http://lists.mysql.com/dotnet
>> To unsubscribe: 
>> http://lists.mysql.com/dotnet?unsub=1
>>
>>
>
>
> -- 
> MySQL on .NET Mailing List
> For list archives: http://lists.mysql.com/dotnet
> To unsubscribe: 
> http://lists.mysql.com/dotnet?unsub=1
>
> 

Thread
get errorJorge Bastos21 Nov
  • RE: get errorPatrick Questembert21 Nov
    • Re: get errorJorge Bastos22 Nov
    • Re: get errorJorge Bastos22 Nov
    • Re: get errorJorge Bastos22 Nov