well thanks expert team it solve some of my prob but tell me how can i pick up reports on sql query basis bcz it works in sql but doesnt shows any result there would be a single command plz tell me that or if just ignore the sql query method hten its possible for to do it with record selection formula........i just wrriten code here plz tell me for this...........the prob is that i used also record selection formula then it gives arror that "remaining part of text is not a part of this" so wats this prob.........solve this also i know it was a time problem when picking it from database how it can be solve and how i can rid of this itme prob..........
Dim ds1 As New DataSet
If cn.State = ConnectionState.Open Then
cn.Close()
End If
cn.Open()
Try
With da
.SelectCommand = New OleDbCommand
.SelectCommand.Connection = cn
.SelectCommand.CommandText = "select * from invoice where datepart(vdate) = '" & dt2.Value & "' between '" & dt3.Value & "' "
.Fill(ds1, "invoice")
End With
Dim obj As New crv2
'obj.RecordSelectionFormula = "{invoice.vdate}= '" & dt2.Value & " ' "
rpt2.ReportSource = obj
rpt2.Refresh()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Ok glad that was helpful, but now this statement makes very little sense:
"
..how can i pick up reports on sql query basis bcz it works in sql but doesnt shows any result there would be a single command plz tell me that or if just ignore the sql query method hten its possible for to do it with record selection formula."
Reports are always based on an SQL basis from a database.
What works in SQL? The Select statement? It should work in both ASP.Net and SQL (with minor language modification differences).
Here is a thought, if the following code is not pulling the results you want:
.SelectCommand.CommandText = "select * from invoice where datepart(vdate) = '" & dt2.Value & "' between '" & dt3.Value & "' "
.Fill(ds1, "invoice")
Then I would take this SELECT statement, place it in SQL, modify the parameters with the values you think the statement should be receiving and see if the results you want are returned. IF they are, then it maybe a slight issue with the parameters, datepart, or such.
If it doesn't then their is a flaw in the SQL statement.
Single Statement? For what? When speaking about a query, it is extremely helpful if you provide the table structure (for the tables involved in your query) for us to help you.
REMEMBER: we are not working on the same project as you, so you have to be very specific and concise about what you are trying to do and what you are having problems with..
And always, use breakpoints in your code and walk through it, to be certain the values being passed are what you think they are. Thinking you coded it and it will work, without walking through it (even on paper) is far more time consuming because you are working on a false assumption.
Your statement above states a few things, but all in a very very vague way. So please provide concise points, rather than long run on sentences speaking from a level which would only make sense if we were working on the project.
Lastly, please use code blocks around your code:
[ code]
' code [ /code]