0

Dear all. I need help regarding on my error.. this is the sample code:

Private Sub GetDetails(ByVal id As String)
        Dim conString As String = (ConfigurationManager.ConnectionStrings.Item("ItemListing").ToString)
        Dim objConnection As New MySqlConnection(conString)
        objConnection.Open()
        Dim sdr As MySqlDataReader
        Dim sSQL As String = " SELECT i.SuppCode,s.SuppName,s.telno,s.Faxno,s.email,s.Salesman,s.Mobileno,s.add1," & _
                             " i.masterefno, i.invoicerefno,a.remarks, i.approval_date, i.approveby, a.new_listing_fee, a.totalamount, a.collectedby,a.otherinfor" & _
                             " FROM Supplier AS s, itemdetail AS i, account AS a" & _
                             " WHERE i.SuppCode = '" & id & "'" & _
                             " AND s.suppcode=i.suppcode" & _
                             " AND i.masterefno=a.masterefno" & _
                             " AND s.suppcode=a.suppcode" & _
                             " AND i.isApprove LIKE 'Approve%'" & _
                             " GROUP BY s.SuppCode,i.masterefno"
        Dim objCommandGrid As New MySqlCommand(sSQL, objConnection)
        sdr = objCommandGrid.ExecuteReader
        If sdr.HasRows() Then
            sdr.Read()
            txtsuppcode.Text = sdr("SuppCode").ToString()
            txtsuppname.Text = sdr("SuppName").ToString()
            txttelno.Text = sdr("telno").ToString()
            txtfax.Text = sdr("faxno").ToString()
            txtemail.Text = sdr("email").ToString()
            txtsalesman.Text = sdr("Salesman").ToString()
            txtmobile.Text = sdr("mobileno").ToString()
            txtadd.Text = sdr("add1").ToString()
            txtMRef.Text = sdr("masterefno").ToString()
            txtIRef.Text = sdr("Invoicerefno").ToString()
            txtcdate.Text = sdr("Approval_Date").ToString()
            txtcreatedby.Text = sdr("Approveby").ToString()
            txtfee.Text = sdr("new_listing_fee").ToString()
            txtTotal.Text = sdr("totalamount").ToString()
            txtcollected.Text = sdr("collectedby").ToString()
            txtoinfor.Text = sdr("otherinfor").ToString()
        End If
        objConnection.Close()
    End Sub

The error come from this coding below. The problem happen when i choose the "id" to execute and check using local debug. The "id" suddenly changing automatically.
I don't cannot figure out how to solve this problem.

Private Sub GetItemDetails(ByVal id As String)
        Dim conString As String = (ConfigurationManager.ConnectionStrings.Item("ItemListing").ToString)
        Dim objConnection As New MySqlConnection(conString)
        objConnection.Open()
        Dim strsql As String = " SELECT i.fulldescription,i.productcode,i.pack_no,i.group_id," & _
                             " a.unitcost_by_ctn,a.unitcost_by_pcs,a.netcost_by_ctn,a.netcost_by_pcs," & _
                             " a.sp_by_ctn, a.sp_by_pcs, a.remarks" & _
                             " FROM itemdetail AS i, supplier AS s, account AS a" & _
                             " WHERE s.suppcode ='" & id & "'" & _
                             " AND a.suppcode = i.suppcode" & _
                             " AND i.isApprove LIKE 'Approve%'" & _
                             " AND a.productcode = i.productcode" & _
                             " GROUP BY i.suppcode"
        Dim objCommandGrid As New MySqlCommand(strsql, objConnection)
        GridItem.DataSource = objCommandGrid.ExecuteReader
        GridItem.DataBind()
        objConnection.Close()
        objConnection.Dispose()
    End Sub

i hope someone can help me to solve this problem.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by CrappyCoder
0

>The "id" suddenly changing automatically.

Its difficult to imagine what's happening. Please post complete code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.