-
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
-
You are using cmdAs as your SQL Command but cmdrpt as your reader.
What is cmdrpt? Where is that defined? Not that it matters, I think if you do
Code:
Dim cmdAs New SqlCommand(SQLSTR, conn)
Dim rdr As SqlDataReader = cmdAs.ExecuteReader()
you will be better off.
-
Dim rdr As SqlDataReader
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 cmd As New SqlCommand(SQLSTR, conn)
rdr = cmd.ExecuteReader
'cmd.ExecuteNonQuery()
Dim table As New DataTable()
table.Load(rdr)
Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
ReportForm.Load(ReportName)
ReportForm.SetDataSource(table)
this is the whole code , sorry as there was some typing error frm my end
here i have executed the reader and then populated a datatable
Similar Threads
-
By Soteriologist in forum ASP.NET
Replies: 4
Last Post: 05-05-2008, 10:00 AM
-
By jadeite100 in forum Java
Replies: 0
Last Post: 06-28-2007, 09:55 AM
-
By Sandra in forum VB Classic
Replies: 0
Last Post: 07-19-2002, 01:41 AM
-
By Hian Chew in forum VB Classic
Replies: 1
Last Post: 03-28-2001, 12:45 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|