#1
A sample like
 Function GetCardholderByFirst(ByVal firstName As String) As 
System.Data.DataSet
...
 Dim dataAdapter As System.Data.IDbDataAdapter = New 
System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New 
System.Data.DataSet
dataAdapter.Fill(dataSet)
Return dataSet
End Function 

is 25-60 x slower than the using a DataReader to return the data and bind 
it. JUST SAY NO TO DATASETS TO FILL THINGS!

http://learnasp.com/freebook/learn/dbopensqlserver.aspx
shows you model for code based on a DataReader

Function GetCardholderByFirst(ByVal firstName As String) As 
System.SQLClient.SQLDataReader
...

        Dim Rdr as SQLDataReader
        Rdr=dbCommand.ExecuteReader()

 Return Rdr
End Function 

#2
Dynamic Search building SQL Example is @
http://learnasp.com/freebook/learn/searchertypical.aspx

#3
Close Connections and Readers in a FINALLY and use error trapping
http://learnasp.com/freebook/learn/dbopensqlserver.aspx
will show you how


On 9/16/05, Anna Leon <[EMAIL PROTECTED]> wrote:
> 
>  That is all of the code. I didn't set anything (values) before the search 
> button is pushed. And I know I should have one set of control and one 
> function, but I am not sure how to write code to dynamically build the SQL 
> depending on the parameters provided. Can you provide some guidance?
> 
> Thanks.
> 
> 
> Dean Fiala <[EMAIL PROTECTED]> wrote:
> You seem to have two sets of controls, lname, fname, and lname2, fname2.
> 
> And 2 search buttons, and lots of duplicated code, this makes it confusing 
> 
> to read and debug.
> 
> Have you tried setting a break point and stepping through the code and 
> seeing what path is getting followed?
> 
> There also appears to be code missing here, because from your description 
> of 
> the problem something is getting set before the search button is pushed. 
> Are 
> you setting the values for any of the controls elsewhere?
> 
> The first thing I would do is get down to one set of controls and one 
> search 
> button.
> Then I'd write one function called
> 
> GetCardHolder(firstname as string, lastname as string)
> 
> In this function you dynamically build your SQL depending on which parm(s) 
> 
> have been supplied (ideally you shoud have all your SQL in a stored proc, 
> but that's an issue for another day). This will get all your data access 
> code in one function and make it easier to see what's happening. Won't 
> solve 
> your problem, but will make it easier to get a handle on where it is.
> 
> 
> 
> -- 
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> SPONSORED LINKS 
> Basic programming language Computer programming languages Programming 
> languages Java programming language The history of computer programming 
> language 
> 
> ---------------------------------
> YAHOO! GROUPS LINKS 
> 
> 
> Visit your group "AspNetAnyQuestionIsOk" on the web.
> 
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
> 
> 
> ---------------------------------
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> [Non-text portions of this message have been removed]
> 
>  
> 
>  SPONSORED LINKS 
>   Basic programming 
> language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=clJRDppRYABhs6xUhzokKw>
>   Computer 
> programming 
> languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=RiWZhYTiihJ1rWfeFgB2sg>
>   Programming 
> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=2BgLsjKfGvxPndstKBMU9g>
>    Java 
> programming 
> language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=4wWSX5WKx7BCK9SrMVdrxQ>
>   The 
> history of computer programming 
> language<http://groups.yahoo.com/gads?t=ms&k=The+history+of+computer+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=iNvYp6cfd9HwtDhK1iV-rg>
>   
>  ------------------------------
> YAHOO! GROUPS LINKS 
> 
> 
>    - Visit your group 
> "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>" 
>    on the web.
>     - To unsubscribe from this group, send an email to:
>    [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>     - Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
>    Service <http://docs.yahoo.com/info/terms/>. 
> 
> 
>  ------------------------------
>


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to