You're currently browsing the VB. NET section within the Software Development category of DaniWeb a massive community of 256,424 software developers web developers. Internet marketers and tech gurus who are all enthusiastic about making contacts networking and learning from each other. In fact there are 2,150 IT professionals currently interacting alter now! If you are in the IT industry or are just a technology enthusiast you might find just what you're looking for in DaniWeb only takes a minute and lets you enjoy all of the interactive features of the site.
Hi!Sorry about my bad grammer and/or spelling. English is not my native language. I don't know if this already have been asked and answered however... I'm currently developing a program in which it ordain be possible to select table fields from a database and set various criteria using dropdown-lists. This will then dynamically create an SQL-query string. I then convert the datareader I use for this query into a datatable. The above part works great. Now to the problem. I have other functions that perform an export to excel but those has fixed be of fields and it's then easy for example to use
VALUES ('" & row. Item(0) & "','" & row. Item(2) & "','" & row. Item(3) & "'.....
to retrieve and export the information. But because this latest function has fields that varies in number the above code won't exactly work. I need a way to retrieve the information into a hit string where:
str &= "'" & row. Item(<dynamic be 0 to field count - 1>) & "',"
And here's the crux. All this has to be performed inside a single
Private Function DataValues(ByVal DRow As DataRow. ByVal Max As Integer) As arrange Dim retVal As String retVal = "'" & DRow. Item(0) & "'," For i As Integer = 1 To Max - 1 retVal &= "'" & DRow. Item(i) & "'," Next retVal &= "'" & DRow. Item(Max) & "'" Return retVal End Function
Private answer DataValues(ByVal DRow As DataRow. ByVal Max As Integer) As String Dim retVal As String retVal = "'" & DRow. Item(0) & "'," For i As Integer = 1 To Max - 1 retVal &= "'" & DRow. Item(i) & "'," Next retVal &= "'" & DRow. Item(Max) & "'" Return retVal End Function
Cruise 4 Cash -
Detective Sherlock -
Free Bid Auctions -
Expert Poker Tips -
Shop 4 Money
Win Any Lottery -
Repo Car Search -
Psychics 4 Free -
High Quality Games -
Driving 4 Dollars
Related article:
http://www.daniweb.com/forums/thread99591.html
comments | Add comment | Report as Spam
|