Gotcha, so the name I give in the Fill statement is like an "alias" to
reference it later on the repeater's DataSource.
Thanks a lot Vinu, I think it's clear now.
Cheers,
Marc
"vinu" <> escribió en el mensaje
news:...
> Hello Mark,
>
> There is nothing wrong with you code. I thing you are getting confused.
> The simplest way to understand this is..
> When you execute the sql statement you get the resultset which satisfies
> the all your join condition, that resultset then get loaded in to dataset.
> Think like dataset as basket, where you can store lot of item. The table
> name you give in the Fill statement has nothing to do with actual table,
> you can specify any name.
>
> Hope its clear now....
>
> vinu
>
>
>
>
>
> "Marc Llenas" <> wrote in message
> news:%...
>> Hello all,
>>
>> I'm new to ASP.NET and I have a question regarding the fill method of a
>> dataset.
>>
>> Here is my code
>>
>> 1 Dim objConn As OleDbConnection
>> 2 Dim objAdapt As OleDbDataAdapter
>> 3 Dim strConn As String
>> 4 Dim strSQL As String
>> 5 Dim objDataSet As New DataSet
>> 6
>> 7 'Build the connection string
>> 8 strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
>> Server.MapPath("App_data\backend.mdb") & ";Persist Security Info=False"
>> 9
>> 10 'Build the SQL string
>> 11 strSQL = "SELECT TblProperty.ProID, TblProperty.ProName,
>> [TblCategory]![CatNumber] & ' Estrellas (' & [TblCategory]![CatStars] &
>> ')' AS FullCat, [TblProperty]![ProCity] & ' (' &
>> [TblProperty]![ProProvince] & ')' AS FullLocation,
>> TblProperty.ProDescription, TblProperty.ProImagePath,
>> TblProperty.ProLogo1Path, TblProperty.ProLogo2Path,
>> TblProperty.ProLogo3Path, TblProperty.ProLogo4Path FROM TblCategory INNER
>> JOIN TblProperty ON TblCategory.CatID = TblProperty.ProCatID;"
>> 12
>> 13 'Create the connection and command objects
>> 14 objConn = New OleDbConnection(strConn)
>> 15 objAdapt = New OleDbDataAdapter(strSQL, objConn)
>> 16
>> 17 'Fill the dataset with the results of the query
>> 18 objAdapt.Fill(objDataSet, "TblProperty")
>> 19
>> 20 'Set the repeater's source to the dataset and bind the data
>> 21 objRepeater.DataSource = objDataSet.Tables("TblProperty").DefaultView
>> 22 objRepeater.DataBind()
>>
>> My question is related to line's 18 and 21. In all examples I have
>> reviewed the SQL string relates to a single table and the name of that
>> table is refered in those lines.
>>
>> In my case my SQL sentence has a join so I'm not sure how to go about it.
>>
>> Any suggestions?
>>
>> Thanks,
>>
>> Marc
>>
>>
>>
>
>
|