anand kulkarni

anand kulkarni

  • NA
  • 99
  • 48.8k

Connected from c# to mysql . Insert record problem .

Nov 20 2013 8:17 AM
Hello experts , 
I am a Vfp/Mysql developer since 15 to 16 years . I just started C # learning . I have successfully connected the mysql schema and got some selected records to grid view in C # . I am facing a Record insert problem . Please Just check out the error log .  I am getting Mysql exception handling error . 
MySql.Data.MySqlClient.MySqlException was unhandled
Message=Fatal error encountered during command execution.
Source=MySql.Data
ErrorCode=-2147467259
Number=0
StackTrace:
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at ConnectCsharpToMysql.DBConnect.Insert(String wglcode, String wglname) in D:\ConnectCsharpToMysql_Source\ConnectCsharpToMysql\<a target='_blank' href='http://dbconnect.cs/' rel='nofollow'>DBConnect.cs:line 104
at ConnectCsharpToMysql.Form1.bInsert_Click(Object sender, EventArgs e) in D:\ConnectCsharpToMysql_Source\ConnectCsharpToMysql\<a target='_blank' href='http://form1.cs/' rel='nofollow'>Form1.cs:line 29
at System.Windows.Forms.Control.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.Control.ControlNativeWindow.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(Int32 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 ConnectCsharpToMysql.Program.Main() in D:\ConnectCsharpToMysql_Source\ConnectCsharpToMysql\<a target='_blank' href='http://program.cs/' rel='nofollow'>Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: MySql.Data.MySqlClient.MySqlException
Message=Parameter '@wglcode' must be defined.
Source=MySql.Data
ErrorCode=-2147467259
Number=0
StackTrace:
at MySql.Data.MySqlClient.Statement.SerializeParameter(MySqlParameterCollection parameters, MySqlPacket packet, String parmName)
at MySql.Data.MySqlClient.Statement.InternalBindParameters(String sql, MySqlParameterCollection parameters, MySqlPacket packet)
at MySql.Data.MySqlClient.Statement.BindParameters()
at MySql.Data.MySqlClient.PreparableStatement.Execute()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
InnerException: 

Thanks in Advance . 
anand 


Answers (1)