Results 1 to 3 of 3

Thread: Display data in datagrid

  1. #1
    Expert Member
    Join Date
    Oct 2006
    Answers
    209

    Display data in datagrid

    How to display the data with field - "custname" beginning only with "S" in datagrid

    NOTE : [This question was asked by Mudduswamy, I am posting it in proper forum]


  2. #2
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: Display data in datagrid

    use the query

    SELECT * FROM cust WHERE custname LIKE 's%';

    to select custname starting with s.

    Fill the dataset with those records and populate the datagrid.


  3. #3
    Contributing Member
    Join Date
    May 2007
    Answers
    60

    Re: Display data in datagrid

    Hi,

    I am sending the code for your requirement. First u need to import the System.data.sqlclient namespace.

    Write the follwing code in Form_Load

    Dim cn as new SqlConnection("connectionstring")
    Dim da as new SqlDataAdapter("select custname from customers where custname like 's%'", cn)
    Dim ds as new DataSet
    da.fill(ds,"customers")
    DataGrid1.datasource=ds.tables("customers")

    If it is not working please inform to me.....

    Regards,
    hari prasad


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact