I ceated a table with a UserID field. This is a uniqueidentifier type field. (I would use this as foreign key of the UserID from aspnetdb..aspnet_users table.)
The problem is that I can't figure out how to insert data in it. Here's my current code.
The first line under 'insert data' gives me this error: Value of type 'System.Guid' cannot be converted to 'String'.
I would appreciate any help.
Thanks.
The problem is that I can't figure out how to insert data in it. Here's my current code.
Code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
'get user id
'if user is not logged in then exit sub
Dim CurrentUser As Guid
Dim theUser As MembershipUser = Membership.GetUser()
If theUser Is Nothing Then
lblMessage.Text = "You need to log in first."
Exit Sub
Else
CurrentUser = theUser.ProviderUserKey
End If
'insert data
SqlDataSource1.InsertParameters("UserID").DefaultValue = CurrentUser [b]'(THIS WON'T WORK)[/b]
SqlDataSource1.InsertParameters("CategoryID").DefaultValue = drpCategoryID.DataValueField
SqlDataSource1.InsertParameters("Title").DefaultValue = txtTopicTitle.Text
SqlDataSource1.InsertParameters("Details").DefaultValue = txtTopicDetails.Text
End Sub
The first line under 'insert data' gives me this error: Value of type 'System.Guid' cannot be converted to 'String'.
I would appreciate any help.
Thanks.