It is very difficult to write a blog on csdn because it is very slow and information will be lost, which makes me very depressed. For this reason, I want to move the blog on csdn TO THE cnblog. However, I found that wlw can be used to write both a csdn blog and a cnblog. I would like to give it a try and I will not move it if I can. I still like the csdn environment.
TestCodeCan be inserted. The paste as vs code plug-in is used here, instead of the windowslivewriter. sourcecode. dll plug-in.
Code snippet
- private sub cmdimportusers_click ( byval sender as system. object, byval E as system. eventargs) handles cmdimportusers. click
- DimXmldocAs NewXmldocument
-
- Xmldoc. loadxml (txtuserxml. Text)
-
- 'Update the user record in the database
- dim responsebuilder as stringbuilder = New stringbuilder ()
- For EachXmlitemAsXmlelementInXmldoc. selectnodes ("/Users/user")
-
-
- DimOuserinfoAs NewUserinfo
-
- Ouserinfo. portalid = 0
-
- Ouserinfo. Membership. Username = getxmlitemvalue (xmlitem,"Username")
- Ouserinfo. Username = getxmlitemvalue (xmlitem,"Username")
-
- Ouserinfo. profile. firstname = getxmlitemvalue (xmlitem,"Firstname")
-
- Ouserinfo. firstname = getxmlitemvalue (xmlitem,"Firstname")
- Ouserinfo. profile. lastname = getxmlitemvalue (xmlitem,"Lastname")
-
- Ouserinfo. lastname = getxmlitemvalue (xmlitem,"Lastname")
-
- Ouserinfo. profile. unit = getxmlitemvalue (xmlitem,"Unit")
- Ouserinfo. profile. Street = getxmlitemvalue (xmlitem,"Street")
-
- Ouserinfo. profile. City = getxmlitemvalue (xmlitem,"City")
-
- Ouserinfo. profile. region = getxmlitemvalue (xmlitem,"Region")
- Ouserinfo. profile. postalcode = getxmlitemvalue (xmlitem,"Postalcode")
-
- Ouserinfo. profile. Country = getxmlitemvalue (xmlitem,"Country")
-
- Ouserinfo. profile. Telephone = getxmlitemvalue (xmlitem,"Telephone")
- Ouserinfo. Membership. Email = getxmlitemvalue (xmlitem,"Email")
-
- Ouserinfo. Email = getxmlitemvalue (xmlitem,"Email")
-
- Ouserinfo. Membership. Approved =True
-
- Ouserinfo. affiliateid = NULL. nullinteger
- Ouserinfo. Membership. Password = getxmlitemvalue (xmlitem,"Password")
-
- DimCreatestatusAsUsercreatestatus = usercontroller. createuser (ouserinfo)
-
-
-
- 'If createstatus = usercreatestatus. Success then
- 'Responsebuilder. appendline (string. Format ("User '{0} 'created successfully", ouserinfo. username ))
-
-
-
- 'Else
-
- 'Responsebuilder. appendline (string. format ("User '{0} 'creation failed: {1}", ouserinfo. username, [Enum]. getname (GetType (usercreatestatus), createstatus )))
-
-
- 'End if
-
- 'Only users who failed to import will be output.
-
- IfCreatestatus <> usercreatestatus. SuccessThen
- Responsebuilder. appendline (String. Format ("User '{0} 'creation failed: {1 }", Ouserinfo. username, [Enum]. getname (GetType(Usercreatestatus), createstatus )))
-
- End If
-
-
- Next
-
- Txtuserxml. Text = responsebuilder. tostring ()
-
- End Sub
Then we can test whether images can be uploaded.