Greetings everyone,

Can someone help me please on this error, you can also point to me where the converstion of the data type happen.

 If Not ListView1.Items.Count = 0 Then
            Do Until iLoop = ListView1.Items.Count
                lvitem = ListView1.Items.Item(iLoop)
                With lvitem
                    query3.Connection.Open()

                    query3.CommandText = String.Format("INSERT INTO workout_title_tbl VALUES((Select customer_Id From registered_cust_tbl),@workout_Title,@customer_Workout,@workoutType,@workoutInstruct,@date_Created,@time_Created)")
                    query3.Parameters.Add("@workout_Title", SqlDbType.VarChar).Value = routineNameLbl.Text
                    query3.Parameters.Add("@customer_Workout", SqlDbType.VarChar).Value = .SubItems(0).Text
                    query3.Parameters.Add("@workoutType", SqlDbType.VarChar).Value = .SubItems(1).Text
                    query3.Parameters.Add("@workoutInstruct", SqlDbType.VarChar).Value = .SubItems(2).Text.ToString
                    query3.Parameters.Add("@date_Created", SqlDbType.Date).Value = DateAndTime.Now.ToShortDateString
                    query3.Parameters.Add("@time_Created", SqlDbType.VarChar).Value = DateAndTime.Now.ToShortTimeString

                    query3.ExecuteNonQuery()
                End With
                iLoop = iLoop + 1
                lvitem = Nothing
            Loop
        End If

Thank you in advance.

I don't see SqlDbType.Int in any of your parameters. If the error is complaining about converting varchar to int, then it seems one of your columns is defined as an integer and you need to treat the parameter accordingly.

Well i managed to solve it by moving one row on top @__@. i just realized that the error was pointing to the incorrect row on the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.