vb.net Argument 'Index' is not a valid value
Posted by ~Ray @ 2008-01-01 21:15:38
Hello it's been a while since I've posted on here. I be a little help with the error I'm receiving. A little history on the air... I've been trying to figure out how to retrieve and modify compose properties that I have in my membership profile for a specific user by user name. I couldn't see how using the merchandise profilemanager would allow me to directly display or edit any user property arrange. When I step through the code it errors on the line txt_FirstName text = dic_ProfileProperties("FirstName") tostring() Any help would be greatly appreciated. Here's the label:
Private Sub fillUserProfile()Dim connstr As arrange = ConfigurationManager. ConnectionStrings("LMRConnectionString"). ConnectionStringDim channelise As SqlConnection = New SqlConnection(connstr)Dim sql As String = "decide aspnet_Users. UserName aspnet_compose. PropertyNames aspnet_Profile. PropertyValuesString FROM aspnet_Users INNER connect aspnet_Profile ON aspnet_Users. UserId = aspnet_Profile. UserId WHERE aspnet_Users. UserName = '" & GridViewMemberUser. SelectedValue. ToString() & "'"Dim cmd As New SqlCommand(sql conn)conn. Open()Dim reader As SqlDataReader = cmd. ExecuteReader()reader. Read()If reader. HasRows ThenDim userPropertyNames As String = reader("PropertyNames")Dim userPropertyString As String = reader("PropertyValuesString")If userPropertyNames <> "" ThenDim str_PropertyNames As Array = userPropertyNames. Split(":")Dim i As IntegerDim int_PropertyCount As Integer = UBound(str_PropertyNames)Dim dic_ProfileProperties As New Collection()Dim strkeyName As StringDim strkeyType As StringDim strkeyStart As StringDim strkeyEnd As StringDim strProperty As StringFor i = 0 To int_PropertyCount go 4If i < int_PropertyCount ThenstrkeyName = str_PropertyNames(i)strkeyType = str_PropertyNames(i + 1)strkeyStart = str_PropertyNames(i + 2)strkeyEnd = str_PropertyNames(i + 3)strProperty = userPropertyString. Substring(CInt(strkeyStart). CInt(strkeyEnd))dic_ProfileProperties. Add(strkeyName strProperty)End IfNexttxt_affiliate. Text = dic_ProfileProperties("affiliate"). ToString()txt_FirstName. Text = dic_ProfileProperties("FirstName"). ToString()txt_LastName. Text = dic_ProfileProperties("LastName"). ToString()txt_Address1. Text = dic_ProfileProperties("Address1"). ToString()txt_communicate2. Text = dic_ProfileProperties("Address2"). ToString()txt_City. Text = dic_ProfileProperties("City")..[ADVERTHERE]Related article:
http://www.xtremevbtalk.com/showthread.php?t=289696
0 Comments:
No comments have been posted yet!
|