M
Morten Snedker
My code works as intended. I'm just curious if I am approaching it the
right way.
Images have a link upon them. These links can be changed, stored and
retrieved by a stored procedure. I use FindControl to set the
properties of each image. Is that the proper way to do it?
Regards /Snedker
Dim sqlCon As New SqlConnection, reader As SqlDataReader
sqlCon.ConnectionString = conString
Dim h As HyperLink
Try
Dim cmd As New SqlCommand
cmd.CommandText = "spSetAdLinks"
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Connection = sqlCon
sqlCon.Open()
reader = cmd.ExecuteReader
If Not reader.HasRows Then
Response.Write("No records")
Else
While reader.Read
h = FindControl(reader(1).ToString)
h.NavigateUrl = reader(2).ToString
h.Text = reader(3).ToString
h.Target = reader(4).ToString
End While
End If
right way.
Images have a link upon them. These links can be changed, stored and
retrieved by a stored procedure. I use FindControl to set the
properties of each image. Is that the proper way to do it?
Regards /Snedker
Dim sqlCon As New SqlConnection, reader As SqlDataReader
sqlCon.ConnectionString = conString
Dim h As HyperLink
Try
Dim cmd As New SqlCommand
cmd.CommandText = "spSetAdLinks"
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Connection = sqlCon
sqlCon.Open()
reader = cmd.ExecuteReader
If Not reader.HasRows Then
Response.Write("No records")
Else
While reader.Read
h = FindControl(reader(1).ToString)
h.NavigateUrl = reader(2).ToString
h.Text = reader(3).ToString
h.Target = reader(4).ToString
End While
End If