purvabhilare1587's Profile User Rating: -----

Reputation: 0 Apprentice
Active Posts:
41 (0.04 per day)
27-May 12
Profile Views:
Last Active:
User is offline Dec 19 2012 11:17 PM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   purvabhilare1587 has not set their status

Posts I've Made

  1. In Topic: retrieve values from tables having one to many relationship

    Posted 13 Dec 2012

    I think I should post the entire code for search button because the else part does not seem to work too.
     Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchButton.Click
            Dim sqlcon As New SqlConnection(My.Settings.Hardware_DatabaseConnectionString)
            Dim datestr As String
            Dim sqlcmdsearch As New SqlCommand("SELECT Prd_type from Product_Table where Prd_Sr_Key_No='" & SrKeyNoTextBox.Text & "'", sqlcon)
            Dim sdrsearch As SqlDataReader
            Dim sqlcmdsearchcust As New SqlCommand("SELECT Product_Table.*,Customer_Table.* from Product_Table inner join (Customer_Table inner join Prd_Cust_Table on Customer_Table.C_Code=Prd_Cust_Table.C_Code) on Product_Table.Prd_Sr_Key_No = Prd_Cust_Table.Prd_Sr_Key_No where Product_Table.Prd_Sr_Key_No='" & SrKeyNoTextBox.Text & "'", sqlcon)
            Dim sdrsearchcust As SqlDataReader
            Dim sqlcmdsearchvend As New SqlCommand("SELECT Product_Table.*,Vendor_Table.* from Product_Table inner join (Vendor_Table inner join Prd_Vend_Table on Vendor_Table.V_Code=Prd_Vend_Table.V_Code) on Product_Table.Prd_Sr_Key_No=Prd_Vend_Table.Prd_Sr_Key_No where Product_table.Prd_Sr_Key_No='" & SrKeyNoTextBox.Text & "'", sqlcon)
            Dim sdrsearchvend As SqlDataReader
            Dim sqlcmdri As New SqlCommand("SELECT * from Product_Table inner join Service_Centre_Table on Product_Table.S_Code=Service_Centre_Table.S_Code where Product_Table.Prd_Sr_Key_No='" & SrKeyNoTextBox.Text & "'", sqlcon)
            Dim sdrri As SqlDataReader
            Dim sqlcmdother As New SqlCommand("SELECT * from Product_Table where Prd_Sr_Key_No='" & SrKeyNoTextBox.Text & "'", sqlcon)
            Dim sdrother As SqlDataReader
            sdrsearch = sqlcmdsearch.ExecuteReader()
            If sdrsearch.HasRows Then
                While sdrsearch.Read
                    ProductTypeComboBox.Text = sdrsearch.Item("Prd_Type")
                End While
            End If
            If ProductTypeComboBox.Text = "REPAIR(INHOUSE)" Then
                sdrsearchcust = sqlcmdsearchcust.ExecuteReader()
                If sdrsearchcust.HasRows Then
                    While sdrsearchcust.Read
                        ProductNameTextBox.Text = sdrsearchcust.Item("Prd_Name")
                        BrandNameComboBox.Text = sdrsearchcust.Item("Prd_Brand")
                        ProductTypeComboBox.Text = sdrsearchcust.Item("Prd_Type")
                        DetailRichTextBox.Text = sdrsearchcust.Item("Prd_Detail")
                        datestr = sdrsearchcust.Item("Dte_Stck_In")
                        Dim splitstr As String() = datestr.Split("/")
                        ddComboBox.Text = splitstr(0)
                        mmComboBox.Text = splitstr(1)
                        yyyyComboBox.Text = splitstr(2)
                        BroughtByTextBox.Text = sdrsearchcust.Item("Brght_By")
                        NoteRichTextBox.Text = sdrsearchcust.Item("Note")
                        CustomerCodeTextBox.Text = sdrsearchcust.Item("C_Code")
                        CustomerNameTextBox.Text = sdrsearchcust.Item("C_Name")
                        CustomerAddressRichTextBox.Text = sdrsearchcust.Item("C_Address")
                        CustomerContactTextBox.Text = sdrsearchcust.Item("C_Cntct")
                        CustomerContactPersonTextBox.Text = sdrsearchcust.Item("C_Cntct_Prsn")
                    End While
                End If
            ElseIf ProductTypeComboBox.Text = "PURCHASE" Then
                sdrsearchvend = sqlcmdsearchvend.ExecuteReader()
                If sdrsearchvend.HasRows Then
                    While sdrsearchvend.Read
                        ProductNameTextBox.Text = sdrsearchvend.Item("Prd_Name")
                        BrandNameComboBox.Text = sdrsearchvend.Item("Prd_Brand")
                        ProductTypeComboBox.Text = sdrsearchvend.Item("Prd_Type")
                        DetailRichTextBox.Text = sdrsearchvend.Item("Prd_Detail")
                        datestr = sdrsearchvend.Item("Dte_Stck_In")
                        Dim splitstr As String() = datestr.Split("/")
                        ddComboBox.Text = splitstr(0)
                        mmComboBox.Text = splitstr(1)
                        yyyyComboBox.Text = splitstr(2)
                        BroughtByTextBox.Text = sdrsearchvend.Item("Brght_By")
                        NoteRichTextBox.Text = sdrsearchvend.Item("Note")
                        VendorCodeTextBox.Text = sdrsearchvend.Item("V_Code")
                        VendorNameComboBox.Text = sdrsearchvend.Item("V_Name")
                        VendorAddressRichTextBox.Text = sdrsearchvend.Item("V_Address")
                        VendorContactTextBox.Text = sdrsearchvend.Item("V_Cntct")
                        VendorContactPersonTextBox.Text = sdrsearchvend.Item("V_Cntct_Prsn")
                    End While
                ElseIf ProductTypeComboBox.Text = "REPAIRED(INWARD)" Then
                    sdrri = sqlcmdri.ExecuteReader()
                    If sdrri.HasRows Then
                        While sdrri.Read
                            ProductNameTextBox.Text = sdrri.Item("Prd_Name")
                            BrandNameComboBox.Text = sdrri.Item("Prd_Brand")
                            ProductTypeComboBox.Text = sdrri.Item("Prd_Type")
                            DetailRichTextBox.Text = sdrri.Item("Prd_Detail")
                            datestr = sdrri.Item("Dte_Stck_In")
                            Dim splitstr As String() = datestr.Split("/")
                            ddComboBox.Text = splitstr(0)
                            mmComboBox.Text = splitstr(1)
                            yyyyComboBox.Text = splitstr(2)
                            BroughtByTextBox.Text = sdrri.Item("Brght_By")
                            NoteRichTextBox.Text = sdrri.Item("Note")
                            ServiceCentreCodeTextBox.Text = sdrri.Item("S_Code")
                            ServiceCentreNameComboBox.Text = sdrri.Item("S_Name")
                            ServiceCentreAddressRichTextBox.Text = sdrri.Item("S_Address")
                            ServiceCentreContactTextBox.Text = sdrri.Item("S_Cntct")
                            ServiceCentreContactPersonTextBox.Text = sdrri.Item("S_Cntct_Prsn")
                        End While
                    End If
                    sdrother = sqlcmdother.ExecuteReader
                    If sdrother.HasRows Then
                        While sdrother.Read
                            ProductNameTextBox.Text = sdrother.Item("Prd_Sr_Key_No")
                            BrandNameComboBox.Text = sdrother.Item("Prd_Brand")
                            ProductTypeComboBox.Text = sdrother.Item("Prd_Type")
                            DetailRichTextBox.Text = sdrother.Item("Prd_Detail")
                            BroughtByTextBox.Text = sdrother.Item("Brght_By")
                            If IsDBNull("Note") Then
                                NoteRichTextBox.Text = ""
                                NoteRichTextBox.Text = sdrother.Item("Note")
                            End If
                        End While
                    End If
                End If
            End If
            'end of if for product type 
        End Sub
  2. In Topic: Incorrect syntax near keyword 'values'

    Posted 30 Nov 2012

    View Postlar3ry, on 30 November 2012 - 06:11 AM, said:

    It's been many years since I used SQL, but here's a possibility:

    I think there should be a ) before the Values keyword, and perhaps no square brackets. Try:
    "insert into  Product_Table(Prd_Sr_Key_No,Prd_Name,Prd_Brand,Prd_Type,Prd_Detail,Dte_Stck_In,Brght_By,Note,Prd_Data_Crtd_By,Prd_Data_Crtd_Date)  Values(@srkeyno,@prdname,@prdbrand,@prdtype,@prddetail,@dtestckin,@brghtby,@note,@prddatacrtdby,@prddatacrtddate)"

    Hey thnx its working.The closing round bracket before the keyword 'VALUES' was missing.
    and I didn't remove the square brackets.

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown

Contact Information




purvabhilare1587 has no profile comments yet. Why not say hello?