- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
I'm new on LLBLGEN need help
Hello all,actually I'm on a hard sitation as I'm new on that software ,as I'm required to develop a big appliation with it,I not know how to start. In fact,I have basic steps with that software, what I'm facing now it that I hv 3 tables andI want to make a select among the three tables , I want to have my own Custom Select Query like I always have in my Sql Server and return a DataTable that I can Bind the result to a GridView. I need anyone would help me in that or contact me on my Email or Mobile to make the steps for the query please all, I can't move any step forward in my application development .
I'm using VB.Net , Self Servicing in a Web application ASP.NET 3.5
Email/ hoby333 AT yahoo.com
Mob/ +20121977230
You did close your own thread, which means we didn't see it in our support queues.
The documentation contains a lot of examples and 'how do I?' sections, have you looked at these? Also, please check out the example projects we have on our website, so you can familiar yourself with how things are done. The Documentation is huge, but you should try to read some of it, at least the concepts section and some of the using the generated code sections, so you get started.
I have developed a custom code in the User Region for the three tables I have in my application,I call that method from the code.
My Code Method as folows
' __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
Imports System.Data.SqlClient
Namespace Clients
Public Class MyClient
Public Shared Function GetAllClients() As DataTable
Try
Using UTASConnection As New SqlConnection
UTASConnection.ConnectionString = "data source=HOBY333\SQLEXPRESS;initial catalog=SystemBindInvoice;integrated security=SSPI;persist security info=False;packet size=4096"
Using da As New SqlDataAdapter("SELECT sb_ClientTelephone.ClientTelephoneId, sb_ClientTelephone.ClientId, sb_ZzTelephoneType.TelephoneTypeName, sb_Telephone.TelephoneAreaCode, sb_Telephone.TelephoneNumber FROM sb_ClientTelephone INNER JOIN sb_Telephone ON sb_ClientTelephone.TelephoneId = sb_Telephone.TelephoneId INNER JOIN sb_ZzTelephoneType ON sb_Telephone.ZzTelephoneTypeId = sb_ZzTelephoneType.ZzTelephoneTypeId WHERE (sb_ClientTelephone.ClientId = 2)", UTASConnection)
Dim ds As DataSet = New DataSet()
Try
UTASConnection.Open()
da.Fill(ds, "Clients")
If ds.Tables("Clients") IsNot Nothing Then _
Return ds.Tables("Clients")
Catch ex As Exception
''
Finally
UTASConnection.Close()
End Try
End Using
End Using
Catch ex As Exception
''
Finally
''
End Try
End Function
End Class
End Namespace
' __LLBLGENPRO_USER_CODE_REGION_END
and the call for that method as follows:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Try GridView1.DataSource = GetAllClients() GridView1.DataBind() Catch ex As Exception
End Try
End Sub
So,I don't know is it OK t use such Sql query into the classes and code generated by LLBLGEN or that software has its own coopnent andown query which I need to build to get me custome Select fields fron my three tables conjunction.pls, my code till this point works fin ,I don't know is that sql query valid into the generated code or there's a way in LLBLGEN that I can use instead of my SQL Query in code section,I need youe help please ,ASAP,I ca't move any forward step ,all my work is stopped .
Hi Shaymaa, you don't need to do that. LLBLGen simplifies that a lot. You have several options:
**The SQL you want **
SELECT
sb_ClientTelephone.ClientTelephoneId,
sb_ClientTelephone.ClientId,
sb_ZzTelephoneType.TelephoneTypeName,
sb_Telephone.TelephoneAreaCode,
sb_Telephone.TelephoneNumber
FROM(sb_ClientTelephone)
INNER JOIN sb_Telephone
ON sb_ClientTelephone.TelephoneId = sb_Telephone.TelephoneId
INNER JOIN sb_ZzTelephoneType
ON sb_Telephone.ZzTelephoneTypeId = sb_ZzTelephoneType.ZzTelephoneTypeId
WHERE(sb_ClientTelephone.ClientId = 2)
A. DynamicList (ref...) This is a good option if you want to perform custom fetches that return read-only DataTables:
Dim fields As New ResultsetFields(5)
fields.DefineField(ClientTelephoneFields.ClientTelephoneId, 0)
fields.DefineField(ClientTelephoneFields.ClientId, 1)
fields.DefineField(TelephoneFields.TelephoneAreaCode, 2)
fields.DefineField(TelephoneFields.TelephoneNumber, 3)
fields.DefineField(ZzTelephoneTypeFields.TelephoneTypeName, 4)
Dim relations As IRelationCollection = New RelationCollection()
relations.Add(ClientTelephoneEntity.Relations.TelephoneEntityUsingTelephoneId)
relations.Add(TelephoneEntity.Relations.ZzTelephoneTypeEntityUsingTelephoneTypeId)
Dim filter As IPredicateExpression
filter.Add(ClientTelephoneFields.ClientId = 2)
Dim dynamicList As New DataTable()
Dim dao As New TypedListDAO()
dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, filter, relations, True, Nothing, Nothing, 0, 0)
**B. TypedList (ref...) The same as DynamicList but you can design it at LLBLGen Pro Designer. ** C. EntityCollections (ref...) You can fetch the ClientTelephoneCollection and still use the related collections to bind the results to a control (Grid for example). This option is two-way databinding, that means that you can fetch and save it back. With this option you can do some stuff that would improve things: - Using PrefetPaths (ref...) - Fields mapped on related fields (ref...)
Any option you choose, I recommend you put your code at some Business class, a ClienTelephoneCollection partial class, or at the CODE_REGIONS. Maybe AdditionalNamespaces CODE_REGION wont be the best place. Instead you can use CustomEntityCollectionCode CODE_REGION.
Hope helpful.