Hi Folks,
I'm trying to implement a modified membership wizard using asp.net. The application works without the extended membership control and it appears that everything is present and correct when debugging but when I uncomment the ThisDataSource.Insert() command it throws an error saying the provider isn't present!
Any thoughts?
Here is the code that is failing:
[code]
Protected Sub CreateUserWizard1_CreatedU
ser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedU
ser
Dim UserNameTextBox As New TextBox
Dim ThisDataSource As SqlDataSource
Dim user As MembershipUser
Dim UserGuid As New Object
UserNameTextBox = CreateUserWizardStep1.Cont
entTemplat
eContainer
.FindContr
ol("Userna
me")
ThisDataSource = DirectCast(CreateUserWizar
dStep1.Con
tentTempla
teContaine
r.FindCont
rol("Inser
tExtraInfo
"), SqlDataSource)
user = Membership.GetUser(UserNam
eTextBox.T
ext)
UserGuid = user.ProviderUserKey
Response.Write("User = " & user.ToString() & "<BR>")
Response.Write("User Guid = " & UserGuid.ToString() & "<BR>")
Response.Write("This Data Source = " & ThisDataSource.ProviderNam
e.ToString
() & "<BR>")
ThisDataSource.InsertParam
eters.Add(
"User_Id",
UserGuid.ToString())
Response.Write(ThisDataSou
rce.Insert
Command & "<BR>")
' Response.Write(ThisDataSou
rce..ToStr
ing() & "<BR>")
Dim aParameter As Parameter
For Each aParameter In ThisDataSource.InsertParam
eters
Response.Write(aParameter.
Name & "<BR>")
Next
ThisDataSource.Insert()
End Sub
[/code]
Here is the datasource within the page
[code]
<asp:sqlDataSource ID="InsertExtraInfo" runat="server" ConnectionString="<%$Conne
ctionStrin
gs:Test_Au
thorisatio
n_DB %>"
InsertCommand="INSERT INTO [T_UserAgencies] (ua_UserId, ua_AgencyId, ua_StartDate) Values (@User_Id, @Agency_Id, @StartDate)"
ProviderName = "<%$ ConnectionStrings:Test_Aut
horisation
_DB %>">
<InsertParameters>
<asp:ControlParameter Name="Agency_Id" Type="String" ControlId="Agency" PropertyName="Text" />
<asp:ControlParameter Name="StartDate" Type = "DateTime" ControlId="StartDate_TextB
ox" PropertyName="Text" />
</InsertParameters>
</asp:sqlDataSource>
[/code]
and here is the output (where the insert is commented out)
[code]
User = dfgdg
User Guid = ba3b032d-0c2a-4cc5-8828-a2
7e443d5418
This Data Source = Data Source=TCBC17985;Initial Catalog=Test_Authenticatio
n_DB;Integ
rated Security=True
INSERT INTO [T_UserAgencies] (ua_UserId, ua_AgencyId, ua_StartDate) Values (@User_Id, @Agency_Id, @StartDate)
Agency_Id
StartDate
User_Id
[/code]
So everything appears to be present, it just falls on its backside.
Any help gratefully received.
Thanks