Showing posts with label own. Show all posts
Showing posts with label own. Show all posts

Sunday, March 25, 2012

DropDownList inside CreateUserWizard

I am using the createuserwizard, and have set up my own profile table which hold first name, last etc. In my CreateUserWizard, the field for Vendor is a dropdownlist that is to be populated from a list in a database. I set up the form without the createuserwizard, and everything went skippy, but when I placed it into the wizard, I now cannot access the control of the dropdownlist.

I have tried doing..

Using SqlConnectionAsNew SqlConnection(WebConfigurationManager.ConnectionStrings("Personal").ConnectionString)
Dim VendorID As DropDownList
VendorID = CType(CreateUserWizard1.FindControl("VendorName"), DropDownList)

Dim MyReaderAs SqlDataReader
Dim selAsString =String.Format("SELECT VendorID, Name FROM Vendors")
Dim MyCommandAs SqlCommand
MyCommand =New SqlCommand
MyCommand.CommandText = sel
MyCommand.CommandType = CommandType.Text
MyCommand.Connection = SqlConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
But when I go to databind, it says:
Object reference not set to an instance of an object.
VendorID.DataSource = MyReader
Line 30: VendorID.DataValueField = "VendorID"
Line 31: VendorID.DataTextField = "Name"

You actually have not instantiated your data reader. Try this:

Dim MyReaderAsNewSqlDataReader|||

Sorry, I left that line out of my post, but it was in there. I found the solution to my problem though.

I was originally putting in CreateUserWizard1.FindControl("VendorID"), DropDownList)
THe actual code that worked is...
CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("VendorID"), DropDownList)
Works a charm.
It's always a bugger not knowing these little "tricks"!!
Mick

|||

mickyjtwin:

Sorry, I left that line out of my post, but it was in there. I found the solution to my problem though.


I'm glad you found the solution. In the future, please be sure to copy-and-paste your exact code, not an approximation of it. Otherwise others (such as myself) will spend needless time trying to help you to debug problems that don't exist.

Thursday, March 22, 2012

Drop User and schema

How do I determine the schema own by a user, remove them and drop the user?
I am trying to drop a user and I get the following error message:
The database principal owns a schema in the database, and cannot be dropped.
Thanks.
Please disregard. I changed the schema owner under the schema object of the
database.
"Emma" wrote:

> How do I determine the schema own by a user, remove them and drop the user?
> I am trying to drop a user and I get the following error message:
> The database principal owns a schema in the database, and cannot be dropped.
> Thanks.

Drop User and schema

How do I determine the schema own by a user, remove them and drop the user?
I am trying to drop a user and I get the following error message:
The database principal owns a schema in the database, and cannot be dropped.
Thanks.Please disregard. I changed the schema owner under the schema object of the
database.
"Emma" wrote:
> How do I determine the schema own by a user, remove them and drop the user?
> I am trying to drop a user and I get the following error message:
> The database principal owns a schema in the database, and cannot be dropped.
> Thanks.sql

Drop User and schema

How do I determine the schema own by a user, remove them and drop the user?
I am trying to drop a user and I get the following error message:
The database principal owns a schema in the database, and cannot be dropped.
Thanks.Please disregard. I changed the schema owner under the schema object of the
database.
"Emma" wrote:

> How do I determine the schema own by a user, remove them and drop the user
?
> I am trying to drop a user and I get the following error message:
> The database principal owns a schema in the database, and cannot be droppe
d.
> Thanks.