|
-
Apr 25th, 2010, 08:20 AM
#1
Thread Starter
New Member
How do you creating SQL field names dynamically
I have a table with fields player1Name,player2Name..etc. How does one create the field names dynamically. I tried this..doesn't work obviously.
Dim sql As String = "SELECT * FROM myTable WHERE tableName = '" + thisTableName + "'"
Dim cmd As SqlCommand = New SqlCommand(sql, thisConnection)
Dim dr As SqlDataReader
dr = cmd.ExecuteReader
While dr.Read()
For i As Integer = 1 To 7
tablePlayerNames(i) = "dr!player" + Str(i) + "Name"
Next i
End While
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|