Click here to Skip to main content
14,970,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Private Sub dgvPics_RowHeaderMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvPics.RowHeaderMouseClick
       Dim s As System.Drawing.Point
       s = dgvPics.CurrentCellAddress
       Dim i = dgvPics.CurrentRow.Index
       Dim connect As New MySqlConnection(cs) 'connstring
       'connect.ConnectionString = connstring
       Dim toedit As Boolean = True
       If MsgBox("To send Patient to Doctor Click Yes!to edit Record click No", vbYesNoCancel) = MsgBoxResult.Yes Then
           toedit = False
           'get  Dim quiz As String
           Dim confee As String
           confee = InputBox("Please Enter Consultation Fee", "Request Info ", Nothing)

           If confee Is Nothing Or confee = "" Then
               Exit Sub
           End If

           If Not IsNumeric(confee) Then
               MsgBox("Please Only Enter  Numbers")
               Exit Sub
           End If

           Dim comp As String = ""
           ' comp = InputBox("Please Enter Complaint ", "Request Info ", Nothing)

           'If comp Is Nothing Or comp = "" Then
           '    Exit Sub
           'End If
           '   Dim stat As String = "Unattended"
           Dim insertqry As String = "INSERT INTO Scheduletb(SerialNo,Status,CFee,Dates,Times) VALUES(@f1,@f2,@f3,@f5,@f6)"
        Dim RowsAffected As Integer = 0
           Dim insertcmd As New MySqlCommand
           ' insertcmd.Connection = connect
           ' RowsAffected = insertcmd.ExecuteNonQuery()
           With insertcmd
               .CommandText = insertqry
               .Connection = connect
               .Parameters.AddWithValue("@f1", dgvPics.Item(0, i).Value.ToString)
               .Parameters.AddWithValue("@f2", "Unattended")
               .Parameters.AddWithValue("@f3", confee)
               ' .Parameters.AddWithValue("@f4", comp)
               .Parameters.AddWithValue("@f5", FormatDateTime(Date.Today, DateFormat.ShortDate))
               .Parameters.AddWithValue("@f6", FormatDateTime(TimeOfDay.TimeOfDay.ToString, DateFormat.LongTime))

               RowsAffected = .ExecuteNonQuery()
           End With
           If RowsAffected > 0 Then

               MessageBox.Show("Successfully Sent User", "schedule", MessageBoxButtons.OK, MessageBoxIcon.Information)

           End If

What I have tried:

the code used to work then after formatting my machine and reinstalling ,mysql it doesn't update,on inserting only primary numbers show the rest of the fields reads NULL
<img alt="IMG example" src=""/> it doesnt show any error
Updated 11-Jul-16 21:09pm
Suvendu Shekhar Giri 12-Jul-16 3:11am
Make sure that yor MySQL instance/server name is same as before, otherwise do the modifications accordingly.
Jackokzkoome 12-Jul-16 3:25am
thanks Suvendu Shekhar my connection string is Public Const cs As String = "Server=Localhost;Database=padb;Uid=root;Pwd=;" same as before do that really need to be modified

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900