1
Answer

Fatal error encountered during command execution.

Dadu Da

Dadu Da

9y
1.6k
1
 I get following error
 
"Fatal error encountered during command execution."
during get data from MYSQL,my code as followed
 
Public Function CreateDataTable_withSelect(ByRef dt As DataTable, ByVal strSQL As String) As DataTable
Try
Dim con As New connectionClass
dt.Rows.Clear()
objCon = New MySqlConnection
objCon = con.connect
If (objCon.State = ConnectionState.Open) Then objCon.Close()
objCon.Open()
Comm.CommandText = strSQL
Comm.Connection = objCon
Comm.CommandTimeout = 0

adp = New MySqlDataAdapter(Comm)
adp.Fill(dt)
dt.AcceptChanges()
Catch ex As Exception
Displaymsgbox(Formname, "CreateDataTable_withSelect", ex.Message)
Finally
adp.Dispose()
objCon.Close()
objCon.Dispose()
End Try
End Function
 
 
 the sql query as followed
 
"select @rn := @rn + 1 as SRno,(0)as Chk,TableId,TableNo,Pax,Status,Remarks
FROM Res_TableMaster, (SELECT @rn := 0) r
where tableno like'%' and Trans_type<>'Delete' and LocationId='C2940997-4EE4-4544-8EC1-981F0449D2FD' order by TableNo"
 
 
which execute successfully in Mysql server but not by using vb.net code
 
 
 
Answers (1)