Click here to Skip to main content
15,899,632 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: To bind or not to bind? Pin
Dan Mos26-Jan-11 9:23
Dan Mos26-Jan-11 9:23 
GeneralRe: To bind or not to bind? Pin
Dave Kreskowiak26-Jan-11 11:07
mveDave Kreskowiak26-Jan-11 11:07 
AnswerRe: To bind or not to bind? Pin
Dan Mos26-Jan-11 5:36
Dan Mos26-Jan-11 5:36 
GeneralRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 7:05
professionalSander Rossel26-Jan-11 7:05 
AnswerRe: To bind or not to bind? Pin
Luc Pattyn26-Jan-11 7:27
sitebuilderLuc Pattyn26-Jan-11 7:27 
GeneralRe: To bind or not to bind? Pin
DaveyM6926-Jan-11 8:29
professionalDaveyM6926-Jan-11 8:29 
GeneralRe: To bind or not to bind? Pin
Dan Mos26-Jan-11 8:56
Dan Mos26-Jan-11 8:56 
JokeRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 9:43
professionalSander Rossel26-Jan-11 9:43 
Har har... Har Laugh | :laugh:
Using connection As New SqlClient.SqlConnection(My.Settings.MyConnectionString)
         Using cmd As New SqlClient.SqlCommand("select * from smartasses where name = @name", connection)
            cmd.Parameters.Add("name", SqlDbType.VarChar, 50).Value = GetUserFromPostAbove()
            connection.Open()
            Try

               Using reader As SqlClient.SqlDataReader = cmd.ExecuteReader
                  While reader.Read
                     Dim gridRow As New DataGridViewRow
                     gridRow.CreateCells(gridSmartAsses)

                     gridRow.Cells(gridSmartAsses.Columns("name").Index).Value = reader.Item("name")
                     gridRow.Cells(gridSmartAsses.Columns("age").Index).Value = reader.Item("age")
                     gridRow.Cells(gridSmartAsses.Columns("message").Index).Value = reader.Item("message")
                     gridRow.Cells(gridSmartAsses.Columns("funny").Index).Value = reader.Item("funny")
                     ' ... Up to about 20 columns.

                     gridSmartAsses.Rows.Add(gridRow)
                  End While
               End Using

            Finally
               connection.Close()
            End Try
         End Using
      End Using


That's just no way to fill numerous grids with 15 to 20 columns D'Oh! | :doh:
And I know this query looks like it will return only 1 smartass, being GetUserFromPostAbove() (and yes, that name IS in the table :p ), but you can see why we don't want to fill our grids like this anymore Wink | ;)

I never use the SqlClient namespace by the way, we have our own simplified company tool which is top secret! Suspicious | :suss:
So feel free to comment on the code as you see fit. I am here to learn as well Smile | :)
GeneralRe: To bind or not to bind? Pin
Pete O'Hanlon26-Jan-11 10:01
mvePete O'Hanlon26-Jan-11 10:01 
AnswerRe: To bind or not to bind? Pin
Luc Pattyn26-Jan-11 10:09
sitebuilderLuc Pattyn26-Jan-11 10:09 
GeneralRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 10:24
professionalSander Rossel26-Jan-11 10:24 
AnswerRe: To bind or not to bind? Pin
Luc Pattyn26-Jan-11 10:43
sitebuilderLuc Pattyn26-Jan-11 10:43 
JokeRe: To bind or not to bind? Pin
Dan Mos26-Jan-11 8:54
Dan Mos26-Jan-11 8:54 
JokeRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 10:24
professionalSander Rossel26-Jan-11 10:24 
GeneralRe: To bind or not to bind? Pin
Eddy Vluggen26-Jan-11 9:26
professionalEddy Vluggen26-Jan-11 9:26 
AnswerRe: To bind or not to bind? Pin
Eddy Vluggen26-Jan-11 7:09
professionalEddy Vluggen26-Jan-11 7:09 
GeneralRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 9:04
professionalSander Rossel26-Jan-11 9:04 
GeneralRe: To bind or not to bind? Pin
Eddy Vluggen26-Jan-11 9:12
professionalEddy Vluggen26-Jan-11 9:12 
GeneralRe: To bind or not to bind? Pin
Sander Rossel26-Jan-11 10:42
professionalSander Rossel26-Jan-11 10:42 
GeneralRe: To bind or not to bind? Pin
Eddy Vluggen27-Jan-11 7:10
professionalEddy Vluggen27-Jan-11 7:10 
GeneralRe: To bind or not to bind? Pin
Sander Rossel27-Jan-11 10:40
professionalSander Rossel27-Jan-11 10:40 
GeneralRe: To bind or not to bind? Pin
Eddy Vluggen27-Jan-11 11:29
professionalEddy Vluggen27-Jan-11 11:29 
GeneralRe: To bind or not to bind? Pin
Sander Rossel27-Jan-11 11:49
professionalSander Rossel27-Jan-11 11:49 
AnswerRe: To bind or not to bind? Pin
RobCroll26-Jan-11 12:41
RobCroll26-Jan-11 12:41 
AnswerRe: To bind or not to bind? Pin
Abhinav S28-Jan-11 19:27
Abhinav S28-Jan-11 19:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.