SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting records in datatable

    SQLSTR = "INSERT into temrp SELECT * FROM Table1 T" _
    & " LEFT JOIN PRDT P ON T.PID = P.PID" _
    & " JOIN CUSTOMER C ON T.CID= C.CID" _
    & " where month= '" & Month(dtpmonth.Value) & "' and year= '" & Year(dtpyear.Value) "


    Dim cmdAs New SqlCommand(SQLSTR, conn)
    rdr= cmdrpt.ExecuteReader()



    Dim table As New DataTable()
    table.Load(rdr)


    ?table.Columns.Count
    0
    ?table.Rows.Count
    0

    i getthe above results ib debug window but when i check thr' sqlquery analyser i get 3 records

    culd u let me knw whts missing that i am not able to get allthe 3 records in the table

  2. #2
    Non-Member
    Join Date
    May 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using the code make connection then the execute the command the try its code
    sqldatareader dr=cmd.executereader();
    while(dr.read()){

    console.writeline(dr[0].tostring());
    }

    then fetch the result


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •