Click here to Skip to main content
15,942,709 members

Comments by sudheerpolic (Top 3 by date)

sudheerpolic 17-Jul-23 2:37am View    
Sir,

is there any problem with declaring these things in a Module? Actually, I have developed an application in VB6 that is running successfully. I am trying myself to upgrade to .net

Public mycon As New MySqlConnection
Public mcmd As New MySqlCommand
Public myData As New DataTable
Public mdataset As New Data.DataSet
Public mdataadapter As New MySqlDataAdapter
Public mdatareader As MySqlDataReader

Public mycon As New MySqlConnection
Public mcmd As New MySqlCommand
Public myData As New DataTable
Public mdataset As New Data.DataSet
Public mdataadapter As New MySqlDataAdapter
Public mdatareader As MySqlDataReader
sudheerpolic 16-Jul-23 9:21am View    
Respected Sir,

these action also worked successfully

If Len(Txtsrch.Text) < 10 And cbosearch.Text = "MOBILE NO" Or Len(Txtsrch.Text) < 10 And cbosearch.Text = "ALTERNATE NO" Then
MsgBox("Please enter a valid Mobile or Landphone Number")
Exit Sub
End If
Select Case cbosearch.Text
Case "MOBILE NO"
mcmd.CommandText = "select MOB_NO,TSP_NAME,CNAME,CONN_TYPE,BIRTH_DATE,F_H_NAME,L_HOUSE_NO,L_STREET,L_LOCALITY,L_CITY,L_STATE,L_PIN,ALTER_TELE_NO,EMAIL,ACT_DATE,P_HOUSE_NO,P_STREET,P_LOCALITY,P_CITY,P_STATE,ID_DOCMENT_NO,IMSI_NO,REF_NAME,REF_ADD,REF_TELE_NO from addressfull where MOB_NO=@0 order by act_date desc"
Case "ALTERNATE NO"
mcmd.CommandText = "select MOB_NO,TSP_NAME,CNAME,CONN_TYPE,BIRTH_DATE,F_H_NAME,L_HOUSE_NO,L_STREET,L_LOCALITY,L_CITY,L_STATE,L_PIN,ALTER_TELE_NO,EMAIL,ACT_DATE,P_HOUSE_NO,P_STREET,P_LOCALITY,P_CITY,P_STATE,ID_DOCMENT_NO,IMSI_NO,REF_NAME,REF_ADD,REF_TELE_NO from addressfull where ALTER_TELE_NO=@0 order by act_date desc"
Case "ID DOCUMENT NO"
mcmd.CommandText = "select MOB_NO,TSP_NAME,CNAME,CONN_TYPE,BIRTH_DATE,F_H_NAME,L_HOUSE_NO,L_STREET,L_LOCALITY,L_CITY,L_STATE,L_PIN,ALTER_TELE_NO,EMAIL,ACT_DATE,P_HOUSE_NO,P_STREET,P_LOCALITY,P_CITY,P_STATE,ID_DOCMENT_NO,IMSI_NO,REF_NAME,REF_ADD,REF_TELE_NO from addressfull where ID_DOCMENT_NO=@0 order by act_date desc"
Case "IMSI NO"
mcmd.CommandText = "select MOB_NO,TSP_NAME,CNAME,CONN_TYPE,BIRTH_DATE,F_H_NAME,L_HOUSE_NO,L_STREET,L_LOCALITY,L_CITY,L_STATE,L_PIN,ALTER_TELE_NO,EMAIL,ACT_DATE,P_HOUSE_NO,P_STREET,P_LOCALITY,P_CITY,P_STATE,ID_DOCMENT_NO,IMSI_NO,REF_NAME,REF_ADD,REF_TELE_NO from addressfull where IMSI_NO=@0 order by act_date desc"
End Select
mcmd.Connection = mycon
mcmd.Parameters.AddWithValue("@0", Trim(Txtsrch.Text))
mdatareader = mcmd.ExecuteReader()
If mdatareader.Read = False Then
MsgBox("SDR not found.......")
mcmd.Parameters.Clear()
mdatareader.Close()
Exit Sub
End If
If mdatareader.HasRows Then
printaddress()
While mdatareader.Read
printaddress()
End While
End If
'cmd.CommandTimeout = 99999
'da.SelectCommand = cmd
'da.Fill(myData)
'dgvmobilenos.DataSource = myData
mcmd.Parameters.Clear()
mdatareader.Close()
sudheerpolic 15-Jul-23 21:13pm View    
MySql.Data.MySqlClient.MySqlException
HResult=0x80004005
Message=Fatal error encountered during command execution.
Source=MySql.Data
StackTrace:
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at MysqlConCode.frmmain.btntrack_Click(Object sender, EventArgs e) in D:\VB.NET TUTORIAL\Mobile Tracker 2022\MysqlConCode\Form1.vb:line 366
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at MysqlConCode.My.MyApplication.Main(String[] Args) in :line 83

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
MySqlException: Fatal error encountered attempting to read the resultset.

Inner Exception 2:
MySqlException: Reading from the stream has failed.

Inner Exception 3:
IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Inner Exception 4:
SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

after putting mdataadapter.InsertCommand = mcmd