Dim Conn_web As SqlConnection

                Conn_web = MyFormz.connec.ConnWeb2(dbName)
                Conn_web.Open()
                Dim sqlcmd_Insert As New SqlCommand(sql_Insert1 + sql_Insert2, Conn_web)

                Try

                    sqlcmd_Insert.ExecuteNonQuery()
                    MsgBox("The New Record has been saved.")


                Catch ex As Exception
                    MsgBox(ex.Message)

                End Try
Sub Insert_New_Converts_Followups(ByVal strFollowup_No As String, ByVal strFollowup_Date As String, ByVal strFollowup_By As String, ByVal strFollowup_Response As String)

        Dim sql_Insert1 As String = "INSERT INTO New_Converts_Followups(VisitorID, Followup_No, Followup_Date, Followup_By, Followup_Response )"

        Dim sql_Insert2 As String = "VALUES ('" & Me.txtNew_ConvertsID.Text & "', '" & strFollowup_No & "', '" & strFollowup_Date & "', '" & strFollowup_By & "', '" & strFollowup_Response & "')"

        MyFormz.cl_Class.Insert_str2_B(sql_Insert1, sql_Insert2, txtDBname.Text)
    End Sub

I used to use this code to do my inserts however i have recently been introduced 2 stored procedures and i came up with this code to insert using the stored procedure but now i am suck when it comes to trying to retrieve the data using the stored procedure

Dim parm1 As New SqlClient.SqlParameter("@Category_ID", "")
        Dim parm2 As New SqlClient.SqlParameter("@Category", "Value1")
        Dim parm3 As New SqlClient.SqlParameter("@Area_Name", "Value2")

        Dim cmd As New SqlClient.SqlCommand

        cmd.CommandText = "dbo.udp_tblArea_ups"

        cmd.CommandType = CommandType.StoredProcedure

        cmd.Parameters.AddRange(New SqlClient.SqlParameter() {parm1, parm2, parm3})

        Dim cn As New SqlClient.SqlConnection("Data Source=******;Initial Catalog=******;User ID=*****;Password=*****")

        cn.Open()

        cmd.Connection = cn

        cmd.ExecuteNonQuery()

        cn.Close()
Function GetArea_dt(ByVal Category_ID As Integer) As DataTable

        Dim da As SqlDataAdapter = ClassClass.sp_da("udp_tblArea_sel")
        Dim dt As New DataTable
        dt.Clear()
        Dim nPara_Col1 As String = "@Category_ID"
        Dim nPara_Value1 As Integer = Category_ID
        da.SelectCommand.Parameters.Add(New SqlParameter(nPara_Col1, nPara_Value1))
        dt = New DataTable
        da.Fill(dt)
        Return dt
        da.Dispose()

    End Function

the function i used to retrieve the data

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.