please help

Posts   
 
    
mahm9
User
Posts: 11
Joined: 10-Mar-2009
# Posted on: 07-Jul-2009 12:13:41   

hi all brothers

    this code work very well 

    Dim rpt As New ReportDocument
    Dim fileName As String = Server.MapPath("rep1.rpt")
    Dim ds As New DataSet
    rpt.Load(fileName)
    DBCon.Close()
    DBCon.Open()
    DBadb = New SqlClient.SqlDataAdapter("select o.ahwal_id,o.FullName,o.salary,e.entedabvalue,e.entedabtype,e.adminname,e.workplacetitle from entedabmony e  inner join officer_data_entery o on o.ahwal_id=e.ahwal_id  where o.ahwal_id=" & AhwalId.Text & "", DBCon)
    DBadb.Fill(ds, "entedabmony")
    rpt.SetDataSource(ds)
    CrystalReportViewer1.ReportSource = rpt



    but to obtain the same result with following code not give true result
    so i ask what the error in the following code



    Dim selectFilter As New PredicateExpression
    Dim sorter As SortExpression
    Dim objRelations As IRelationCollection = New RelationCollection()
    objRelations.Add(OfficerDataEnteryEntity.Relations.EntedabMonyEntityUsingAhwalId)
    If Not [String].IsNullOrEmpty(ahwalid.Text) Then
    selectFilter.AddWithAnd(OfficerDataEnteryFields.AhwalId = AhwalId.Text)
    End If
    sorter = Nothing
    Dim dt As DataTable = EntedabMonyCollection.GetMultiAsDataTable(selectFilter, 0, Nothing, objRelations)
    rpt.SetDataSource(dt)
    CrystalReportViewer1.ReportSource = rpt






    also i tried this code but not also give the true result




    Dim selectFilter As New PredicateExpression
    Dim fields As New ResultsetFields(3)
    fields.DefineField(OfficerDataEnteryFields.AhwalId, 0)
    fields.DefineField(EntedabMonyFields.EntedabValue, 1)
    'fields.DefineField(OfficerDataEnteryFields.FullNmae, 2)
    Dim relations As IRelationCollection = New RelationCollection()
    relations.Add(OfficerDataEnteryEntity.Relations.EntedabMonyEntityUsingAhwalId)
    If Not [String].IsNullOrEmpty(AhwalId.Text) Then
        selectFilter.AddWithAnd(EntedabMonyFields.AhwalId = AhwalId.Text)
    End If

    Dim dynamicList As New DataTable()
    Dim dao As New TypedListDAO()
    dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, selectFilter, relations, True, Nothing, Nothing, 0, 0)
    rpt.SetDataSource(dynamicList)
    CrystalReportViewer1.ReportSource = rpt

   please help me how can do true results and please don't say return to documentations because all of this from documentation
MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 07-Jul-2009 15:48:25   

When you say you are not getting the correct results, what is the actual error that you are experiencing ?

Does the code give an exception ? Does the report contain incorrect data ?

Your query code looks OK - please give us some more information about exactly what the problem is simple_smile

Thanks

Matt

mahm9
User
Posts: 11
Joined: 10-Mar-2009
# Posted on: 08-Jul-2009 07:53:32   

brother the first code give me the result with filteration but second code give me the all data in the table no filteration i tried with the code but no way in all give me same result

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 08-Jul-2009 10:33:07   

Dim objRelations As IRelationCollection = New RelationCollection() objRelations.Add(OfficerDataEnteryEntity.Relations.EntedabMonyEntityUsingAhwalId)

The only thing I could spot in your code right now is the way you define the relation. You should start with the entity you are fetching, as follows.

objRelations.Add(EntedabMonyEntity.Relations.OfficerDataEnteryEntity....)

If this doesn't help, please examine the generated query, compare it with the taregt query and post your findings here.

mahm9
User
Posts: 11
Joined: 10-Mar-2009
# Posted on: 08-Jul-2009 13:25:30   

i tested the modifaction but not working and from where you can check generated query

thanks

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 08-Jul-2009 13:28:24   
mahm9
User
Posts: 11
Joined: 10-Mar-2009
# Posted on: 08-Jul-2009 13:39:38   

more details please

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 08-Jul-2009 14:10:30   

All details are there in the link I've posted.

<system.diagnostics> <switches> <add name="SqlServerDQE" value="3" /> </switches> </system.diagnostics>

Dynamic Query Engine tracing To enable Dynamic Query Engine (DQE) tracing, you can for each different DQE switch it on to level 3 (info) or level 4 (verbose). To do that, you have to make sure the switch for the DQE of the database you want trace information for is defined in the .config file, as shown in the previous section.

mahm9
User
Posts: 11
Joined: 10-Mar-2009
# Posted on: 11-Jul-2009 09:20:39   

My brother walaa thanks about response but you talk with me as expert but i am beginig so i want to show me how can see the the sql statment equl to llblgen which i wrote thats my question beacause ir read the section you sent to me but i am not understand

thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Jul-2009 06:56:37   
  1. Please make sure the compiler go into this IF
If Not [String].IsNullOrEmpty(AhwalId.Text)  ...
  1. Check the generated SQL. To see that, add this to your config file:
<system.diagnostics>
    <switches>
        <add name="SqlServerDQE" value="4" />
    </switches>
</system.diagnostics>

Then, at the point the GetMulti is reached in execution, you will see the executed SQL at the debug console of your solution.

David Elizondo | LLBLGen Support Team