Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server VB.NET
Public Function GetCustomer(ByVal pDealerCode As String, ByVal pCusCode As String) As Customer
       Try
           Dim str As String
           str = "Select * From Customer"
           Dim Dr As SqlDataReader
           If Not (m_daDataAccess.ExecuteQuery(str, Nothing, Dr)) Then
               Return Nothing
           Else
               If (Dr.HasRows) Then
 
?????????????????????
???????????????
?
 
               End If
 
           End If
       Catch ex As Exception
 
       End Try
 

   End Function
 
I want to that on this place "???????" i write such as query
ALL COLUMN NAME RETURN As A Variable
 
what should I do..
Posted 26-Apr-13 1:30am
saimm665
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you mean "How do I get the name of all the columns in an SQL table?" then try this:
SELECT column_name FROM information_schema.columns WHERE table_name = 'Customer'
 
If you don't then what do you mean? (And please, don't SHOUT - it doesn't encourage people to want to respond)
  Permalink  
Comments
RedDK at 26-Apr-13 14:27pm
   
SELECT * FROM INFORMATION_SCHEMA.COLUMNS answers my question, tyvm.
OriginalGriff at 26-Apr-13 14:29pm
   
You're welcome!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Public Class Customer
    Private m_daDataAccess As DataAccess = New DataAccess(CONNECTION_STRING)
    Public Function GetCustomer(ByVal pDealerCode As String, ByVal pCusCode As String) As Customer
        Try
            Dim str As String
            str = "Select * From Customer"
            Dim Dr As SqlDataReader
            If Not (m_daDataAccess.ExecuteQuery(str, Nothing, Dr)) Then
                Return Nothing
            Else
                If (Dr.HasRows) Then
                    Dim Cus As New Customer
                    Cus.AccountCode = Dr("AccountCode")
                    Cus.Address1 = Dr("Address1")
                    Cus.Address2 = Dr("Address2")
                    Cus.Address3 = Dr("Address3")
                    Cus.AdvanceReceipt = Dr("AdvanceReceipt")
                    Cus.AreaOffice = Dr("AreaOffice")
                    Cus.AuxCusCode = Dr("AuxCusCode")
                    Cus.CellNo = Dr("CellNo")
                    Cus.City = Dr("City")
                    Cus.CityCode = Dr("CityCode")
                    Cus.CommunicationVersion = Dr("CityCode")
                    Cus.ContPerson = Dr("CityCode")
                    Cus.CreditDays = Dr("CreditDays")
                    Cus.CreditLimit = Dr("CreditLimit")
                    Cus.CusCatCode = Dr("CusCatCode")
                    Cus.CusCode = Dr("cuscode")
                    Cus.CusDesc = Dr("CusDesc")
                    Cus.CusTypeCode = Dr("CusTypeCode")
                    Cus.DealerCode = Dr("DealerCode")
                    Cus.DivisionCode = Dr("DivisionCode")
                    Cus.DOB = Dr("DOB")
                    Cus.DSMCode = Dr("DSMCode")
                    Cus.Email = Dr("Email")
                    Cus.FatherHusName = Dr("FatherHusName")
                    Cus.FaxNo = Dr("FatherHusName")
                    Cus.GR1Address1 = Dr("GR1Address1")
                    Cus.GR1Address2 = Dr("GR1Address2")
                    Cus.GR1Contact = Dr("GR1Contact")
                    Cus.GR1Name = Dr("GR1Name")
                    Cus.GR1Nic = Dr("GR1Nic")
                    Cus.GR2Address1 = Dr("GR2Address1")
                    Cus.GR2Address2 = Dr("GR2Address2")
                    Cus.GR2Contact = Dr("GR2Contact")
                    Cus.GR2Name = Dr("GR2Name")
                    Cus.GR2Nic = Dr("GR2Nic")
                    Cus.GuestID = Dr("GuestID")
                    Cus.IsActive = Dr("isActive")
                    Cus.IsMCDDealer = Dr("IsMCDDealer")
                    Cus.ISOldCustomer = Dr("ISOldCustomer")
                    Cus.IsPvtLtd = Dr("IsPvtLtd")
                    Cus.LetterType = Dr("LetterType")
                    Cus.NIC = Dr("NIC")
                    Cus.NTNno = Dr("NTNno")
                    Cus.OfficeAddress1 = Dr("OfficeAddress1")
                    Cus.OfficeAddress2 = Dr("OfficeAddress2")
                    Cus.OfficeAddress3 = Dr("OfficeAddress3")
                    Cus.Phone1 = Dr("Phone1")
                    Cus.Phone2 = Dr("Phone2")
                    Cus.PSMCReceiveDate = ("PSMCReceiveDate")
                    Cus.Region = ("Region")
                    Cus.SalesTaxRegNo = ("SalesTaxRegNo")
                    Cus.SoftwareVersion = ("SoftwareVersion")
                    Cus.TransferStatus = ("TransferStatus")
                    Cus.UpdDate = ("UpdDate")
                    Cus.UpdTerm = ("UpdTerm")
                    Cus.UpdUser = ("UpdUser")
                    Cus.URL = ("URL")
                    Return Cus
 
                End If
 
            End If
        Catch ex As Exception
 
        End Try
 

    End Function
#Region "DealerCode"
    Private m_DealerCode As String
    Public Property DealerCode() As String
        Get
            Return m_DealerCode
        End Get
        Set(ByVal value As String)
            m_DealerCode = value
        End Set
    End Property
#End Region
 
#Region "CusCode"
    Private m_CusCode As String
    Public Property CusCode() As String
        Get
            Return m_CusCode
        End Get
        Set(ByVal value As String)
            m_CusCode = value
        End Set
    End Property
#End Region
 
#Region "GuestID"
    Private m_GuestID As String
    Public Property GuestID() As String
        Get
            Return m_GuestID
        End Get
        Set(ByVal value As String)
            m_GuestID = value
        End Set
    End Property
#End Region
 
#Region "CusDesc"
    Private m_CusDesc As String
    Public Property CusDesc() As String
        Get
            Return m_CusDesc
        End Get
        Set(ByVal value As String)
            m_CusDesc = value
        End Set
    End Property
#End Region
 
#Region "FatherHusName"
    Private m_FatherHusName As String
    Public Property FatherHusName() As String
        Get
            Return m_FatherHusName
        End Get
        Set(ByVal value As String)
            m_FatherHusName = value
        End Set
    End Property
#End Region
 
#Region "AuxCusCode"
    Private m_AuxCusCode As String
    Public Property AuxCusCode() As String
        Get
            Return m_AuxCusCode
        End Get
        Set(ByVal value As String)
            m_AuxCusCode = value
        End Set
    End Property
#End Region
 
#Region "Address1"
    Private m_Address1 As String
    Public Property Address1() As String
        Get
            Return m_Address1
        End Get
        Set(ByVal value As String)
            m_Address1 = value
        End Set
    End Property
#End Region
 
#Region "Address2"
    Private m_Address2 As String
    Public Property Address2() As String
        Get
            Return m_Address2
        End Get
        Set(ByVal value As String)
            m_Address2 = value
        End Set
    End Property
#End Region
 
#Region "Address3"
    Private m_Address3 As String
    Public Property Address3() As String
        Get
            Return m_Address3
        End Get
        Set(ByVal value As String)
            m_Address3 = value
        End Set
    End Property
#End Region
 
#Region "ContPerson"
    Private m_ContPerson As String
    Public Property ContPerson() As String
        Get
            Return m_ContPerson
        End Get
        Set(ByVal value As String)
            m_ContPerson = value
        End Set
    End Property
#End Region
 
#Region "CreditDays"
    Private m_CreditDays As Integer
    Public Property CreditDays() As Integer
        Get
            Return m_CreditDays
        End Get
        Set(ByVal value As Integer)
            m_CreditDays = value
        End Set
    End Property
#End Region
 
#Region "CreditLimit"
    Private m_CreditLimit As Decimal
    Public Property CreditLimit() As Decimal
        Get
            Return m_CreditLimit
        End Get
        Set(ByVal value As Decimal)
            m_CreditLimit = value
        End Set
    End Property
#End Region
 
#Region "NIC"
    Private m_NIC As String
    Public Property NIC() As String
        Get
            Return m_NIC
        End Get
        Set(ByVal value As String)
            m_NIC = value
        End Set
    End Property
#End Region
 
#Region "CusTypeCode"
    Private m_CusTypeCode As String
    Public Property CusTypeCode() As String
        Get
            Return m_CusTypeCode
        End Get
        Set(ByVal value As String)
            m_CusTypeCode = value
        End Set
    End Property
#End Region
 
#Region "DOB"
    Private m_DOB As DateTime
    Public Property DOB() As DateTime
        Get
            Return m_DOB
        End Get
        Set(ByVal value As DateTime)
            m_DOB = value
        End Set
    End Property
#End Region
 
#Region "Phone1"
    Private m_Phone1 As String
    Public Property Phone1() As String
        Get
            Return m_Phone1
        End Get
        Set(ByVal value As String)
            m_Phone1 = value
        End Set
    End Property
#End Region
 
#Region "Phone2"
    Private m_Phone2 As String
    Public Property Phone2() As String
        Get
            Return m_Phone2
        End Get
        Set(ByVal value As String)
            m_Phone2 = value
        End Set
    End Property
#End Region
 
#Region "CellNo"
    Private m_CellNo As String
    Public Property CellNo() As String
        Get
            Return m_CellNo
        End Get
        Set(ByVal value As String)
            m_CellNo = value
        End Set
    End Property
#End Region
 
#Region "FaxNo"
    Private m_FaxNo As String
    Public Property FaxNo() As String
        Get
            Return m_FaxNo
        End Get
        Set(ByVal value As String)
            m_FaxNo = value
        End Set
    End Property
#End Region
 
#Region "Email"
    Private m_Email As String
    Public Property Email() As String
        Get
            Return m_Email
        End Get
        Set(ByVal value As String)
            m_Email = value
        End Set
    End Property
#End Region
 
#Region "URL"
    Private m_URL As String
    Public Property URL() As String
        Get
            Return m_URL
        End Get
        Set(ByVal value As String)
            m_URL = value
        End Set
    End Property
#End Region
 
#Region "NTNno"
    Private m_NTNno As String
    Public Property NTNno() As String
        Get
            Return m_NTNno
        End Get
        Set(ByVal value As String)
            m_NTNno = value
        End Set
    End Property
#End Region
 
#Region "AdvanceReceipt"
    Private m_AdvanceReceipt As Decimal
    Public Property AdvanceReceipt() As Decimal
        Get
            Return m_AdvanceReceipt
        End Get
        Set(ByVal value As Decimal)
            m_AdvanceReceipt = value
        End Set
    End Property
#End Region
 
#Region "AccountCode"
    Private m_AccountCode As String
    Public Property AccountCode() As String
        Get
            Return m_AccountCode
        End Get
        Set(ByVal value As String)
            m_AccountCode = value
        End Set
    End Property
#End Region
 
#Region "UpdUser"
    Private m_UpdUser As String
    Public Property UpdUser() As String
        Get
            Return m_UpdUser
        End Get
        Set(ByVal value As String)
            m_UpdUser = value
        End Set
    End Property
#End Region
 
#Region "UpdDate"
    Private m_UpdDate As DateTime
    Public Property UpdDate() As DateTime
        Get
            Return m_UpdDate
        End Get
        Set(ByVal value As DateTime)
            m_UpdDate = value
        End Set
    End Property
#End Region
 
#Region "UpdTerm"
    Private m_UpdTerm As String
    Public Property UpdTerm() As String
        Get
            Return m_UpdTerm
        End Get
        Set(ByVal value As String)
            m_UpdTerm = value
        End Set
    End Property
#End Region
 
#Region "SalesTaxRegNo"
    Private m_SalesTaxRegNo As String
    Public Property SalesTaxRegNo() As String
        Get
            Return m_SalesTaxRegNo
        End Get
        Set(ByVal value As String)
            m_SalesTaxRegNo = value
        End Set
    End Property
#End Region
 
#Region "IsMCDDealer"
    Private m_IsMCDDealer As String
    Public Property IsMCDDealer() As String
        Get
            Return m_IsMCDDealer
        End Get
        Set(ByVal value As String)
            m_IsMCDDealer = value
        End Set
    End Property
#End Region
 
#Region "ISOldCustomer"
    Private m_ISOldCustomer As String
    Public Property ISOldCustomer() As String
        Get
            Return m_ISOldCustomer
        End Get
        Set(ByVal value As String)
            m_ISOldCustomer = value
        End Set
    End Property
#End Region
 
#Region "TransferStatus"
    Private m_TransferStatus As String
    Public Property TransferStatus() As String
        Get
            Return m_TransferStatus
        End Get
        Set(ByVal value As String)
            m_TransferStatus = value
        End Set
    End Property
#End Region
 
#Region "SoftwareVersion"
    Private m_SoftwareVersion As String
    Public Property SoftwareVersion() As String
        Get
            Return m_SoftwareVersion
        End Get
        Set(ByVal value As String)
            m_SoftwareVersion = value
        End Set
    End Property
#End Region
 
#Region "CommunicationVersion"
    Private m_CommunicationVersion As String
    Public Property CommunicationVersion() As String
        Get
            Return m_CommunicationVersion
        End Get
        Set(ByVal value As String)
            m_CommunicationVersion = value
        End Set
    End Property
#End Region
 
#Region "GR1Name"
    Private m_GR1Name As String
    Public Property GR1Name() As String
        Get
            Return m_GR1Name
        End Get
        Set(ByVal value As String)
            m_GR1Name = value
        End Set
    End Property
#End Region
 
#Region "GR1Address1"
    Private m_GR1Address1 As String
    Public Property GR1Address1() As String
        Get
            Return m_GR1Address1
        End Get
        Set(ByVal value As String)
            m_GR1Address1 = value
        End Set
    End Property
#End Region
 
#Region "GR1Address2"
    Private m_GR1Address2 As String
    Public Property GR1Address2() As String
        Get
            Return m_GR1Address2
        End Get
        Set(ByVal value As String)
            m_GR1Address2 = value
        End Set
    End Property
#End Region
 
#Region "GR1Nic"
    Private m_GR1Nic As String
    Public Property GR1Nic() As String
        Get
            Return m_GR1Nic
        End Get
        Set(ByVal value As String)
            m_GR1Nic = value
        End Set
    End Property
#End Region
 
#Region "GR1Contact"
    Private m_GR1Contact As String
    Public Property GR1Contact() As String
        Get
            Return m_GR1Contact
        End Get
        Set(ByVal value As String)
            m_GR1Contact = value
        End Set
    End Property
#End Region
 
#Region "GR2Name"
    Private m_GR2Name As String
    Public Property GR2Name() As String
        Get
            Return m_GR2Name
        End Get
        Set(ByVal value As String)
            m_GR2Name = value
        End Set
    End Property
#End Region
 
#Region "GR2Address1"
    Private m_GR2Address1 As String
    Public Property GR2Address1() As String
        Get
            Return m_GR2Address1
        End Get
        Set(ByVal value As String)
            m_GR2Address1 = value
        End Set
    End Property
#End Region
 
#Region "GR2Address2"
    Private m_GR2Address2 As String
    Public Property GR2Address2() As String
        Get
            Return m_GR2Address2
        End Get
        Set(ByVal value As String)
            m_GR2Address2 = value
        End Set
    End Property
#End Region
 
#Region "GR2Nic"
    Private m_GR2Nic As String
    Public Property GR2Nic() As String
        Get
            Return m_GR2Nic
        End Get
        Set(ByVal value As String)
            m_GR2Nic = value
        End Set
    End Property
#End Region
 
#Region "GR2Contact"
    Private m_GR2Contact As String
    Public Property GR2Contact() As String
        Get
            Return m_GR2Contact
        End Get
        Set(ByVal value As String)
            m_GR2Contact = value
        End Set
    End Property
#End Region
 
#Region "City"
    Private m_City As String
    Public Property City() As String
        Get
            Return m_City
        End Get
        Set(ByVal value As String)
            m_City = value
        End Set
    End Property
#End Region
 
#Region "Region"
    Private m_Region As String
    Public Property Region() As String
        Get
            Return m_Region
        End Get
        Set(ByVal value As String)
            m_Region = value
        End Set
    End Property
#End Region
 
#Region "OfficeAddress1"
    Private m_OfficeAddress1 As String
    Public Property OfficeAddress1() As String
        Get
            Return m_OfficeAddress1
        End Get
        Set(ByVal value As String)
            m_OfficeAddress1 = value
        End Set
    End Property
#End Region
 
#Region "OfficeAddress2"
    Private m_OfficeAddress2 As String
    Public Property OfficeAddress2() As String
        Get
            Return m_OfficeAddress2
        End Get
        Set(ByVal value As String)
            m_OfficeAddress2 = value
        End Set
    End Property
#End Region
 
#Region "OfficeAddress3"
    Private m_OfficeAddress3 As String
    Public Property OfficeAddress3() As String
        Get
            Return m_OfficeAddress3
        End Get
        Set(ByVal value As String)
            m_OfficeAddress3 = value
        End Set
    End Property
#End Region
 
#Region "LetterType"
    Private m_LetterType As String
    Public Property LetterType() As String
        Get
            Return m_LetterType
        End Get
        Set(ByVal value As String)
            m_LetterType = value
        End Set
    End Property
#End Region
 
#Region "CusCatCode"
    Private m_CusCatCode As String
    Public Property CusCatCode() As String
        Get
            Return m_CusCatCode
        End Get
        Set(ByVal value As String)
            m_CusCatCode = value
        End Set
    End Property
#End Region
 
#Region "PSMCReceiveDate"
    Private m_PSMCReceiveDate As DateTime
    Public Property PSMCReceiveDate() As DateTime
        Get
            Return m_PSMCReceiveDate
        End Get
        Set(ByVal value As DateTime)
            m_PSMCReceiveDate = value
        End Set
    End Property
#End Region
 
#Region "DSMCode"
    Private m_DSMCode As String
    Public Property DSMCode() As String
        Get
            Return m_DSMCode
        End Get
        Set(ByVal value As String)
            m_DSMCode = value
        End Set
    End Property
#End Region
 
#Region "CityCode"
    Private m_CityCode As String
    Public Property CityCode() As String
        Get
            Return m_CityCode
        End Get
        Set(ByVal value As String)
            m_CityCode = value
        End Set
    End Property
#End Region
 
#Region "DivisionCode"
    Private m_DivisionCode As String
    Public Property DivisionCode() As String
        Get
            Return m_DivisionCode
        End Get
        Set(ByVal value As String)
            m_DivisionCode = value
        End Set
    End Property
#End Region
 
#Region "AreaOffice"
    Private m_AreaOffice As String
    Public Property AreaOffice() As String
        Get
            Return m_AreaOffice
        End Get
        Set(ByVal value As String)
            m_AreaOffice = value
        End Set
    End Property
#End Region
 
#Region "IsActive"
    Private m_IsActive As String
    Public Property IsActive() As String
        Get
            Return m_IsActive
        End Get
        Set(ByVal value As String)
            m_IsActive = value
        End Set
    End Property
#End Region
 
#Region "IsPvtLtd"
    Private m_IsPvtLtd As String
    Public Property IsPvtLtd() As String
        Get
            Return m_IsPvtLtd
        End Get
        Set(ByVal value As String)
            m_IsPvtLtd = value
        End Set
    End Property
#End Region
 
End Class
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 28 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100