G
Guest
Hi,
I'm trying to create a function that will show the current value of a
datagrid when you go into the edit mode of the datagrid. At the moment when
ever I hit edit it just shows me a list of values in the dropdown list with
the default selected value always chosen, rather than the actual value shown
in the datagrid.
I would really appritiate any help!
Thanks
...:: CODE
Function GetSelectedIndex(ByVal OID As String) As Integer
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("SelectOffice", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim myReader As SqlDataReader = cmd.ExecuteReader()
'Populate the reader
If myReader.HasRows Then
Do While myReader.Read()
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}",
myReader.GetInt32(0), myReader.GetString(1))
Loop
Else
Console.WriteLine("No rows returned.")
End If
myReader.Close()
End Function
I'm trying to create a function that will show the current value of a
datagrid when you go into the edit mode of the datagrid. At the moment when
ever I hit edit it just shows me a list of values in the dropdown list with
the default selected value always chosen, rather than the actual value shown
in the datagrid.
I would really appritiate any help!
Thanks
...:: CODE
Function GetSelectedIndex(ByVal OID As String) As Integer
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("SelectOffice", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim myReader As SqlDataReader = cmd.ExecuteReader()
'Populate the reader
If myReader.HasRows Then
Do While myReader.Read()
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}",
myReader.GetInt32(0), myReader.GetString(1))
Loop
Else
Console.WriteLine("No rows returned.")
End If
myReader.Close()
End Function