When to declare variable as texbox or string?

liunx

Guest
HI guys. I want to learn when to declare a variable as string and when
to declare it as TextBox like the example below?
How to use visual studio .net 2003 to construct these variables for us?

Furthermore, in constructing the sql statement like the example below, when we need to use replace andWhen not to use it.?
How to use visual studio .net 2003 to construct this sql statement for us?

I addition, when to use single ' and when not to use it?

Furthermore, why the 鎼慹place?is used in this particular order in the example below?


I will be happy if some expert teaches me how to use them properly.
A reference to a complete tutorial about these topics is highly appreciated.




Dim tbText0 As String = E.Item.Cells(0).Text
Dim tbText1 As String = E.Item.Cells(1).Text
Dim tbText2 As TextBox = E.Item.Cells(2).Controls(0)


' Update the appropriate record in our database.
Dim objCommand As SqlCommand
Dim strSQLQuery As String

' Build our update command.
strSQLQuery = "UPDATE MATCHES " _
& "SET teamno = '" & Replace(tbText0, "'", "''") & "', " _
& "PLAYERNO = '" & tbText1 & "', " _
& "won = '" & Replace(tbText2.Text, "'", "''") & "' " _
& "WHERE matchno = '" & tbText1 & "';"
 
Back
Top