Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Saturday, March 31, 2012

straightforward way to programmatically retrieve string from db?

Hello -- I'm using asp.net 2 in visual web developer and I'm drawing a blank finding documentation on on this fairly simple task. Since this is the novice's thread, I felt bold enough to ask.

I'd like to programmatically retrieve a string from the aspnet_usermembership database -- the select statement would be something like the below. Can anyone point me at example code to do this programmatically -- so I end up with the LoweredEmail string from the DB? I guess I could either read it directly from the DB, or from a gridview control on the page -- but I'm new to SQL data manipulation and althoug I've seen examples nothing seems to work in this environment and it's probably simpler than I think to those who know what they;re doing..

Thanks for pointers.

"SELECT LoweredEmail FROM aspnet_Membership WHERE username=@dotnet.itags.org.Username"

Hey, just an idea. You can use SqlCommand.ExecuteScalar() to return a single value from database, assuming that your select SQL statment returns a scalar value. The method returns an object type so you need to comvert, in your case, a string type, like something below

...

dim LoweredEmail as String

dim SqlCmd as New SqlCommand("sql stmt", SqlConnObt)

LoweredEmail = CType(SqlCmd.ExecuteScalar(), String)

...


Thanks Bernie I'll give that a shot -- looks to be exactly what I needed.

Richard.


Worked fine -- just needed to do this in a two-stage process to get the GUID for the user from the username, which teyn gets teh email address. So added

Dim SqlEmailCmdAsNew SqlCommand("SELECT LoweredEmail FROM aspnet_Membership WHERE userid=@.Guid", myMembershipConnection)

SqlEmailCmd.Parameters.AddWithValue("@.Guid", userid)

Strange Behavior ASPnet_Wp.exe

Hi all,
i have opened my application and did some work, i could see
i the task manager the Mem usage is 76,476K, I closed my application
and made sure that no instance of .net is running, but when i saw that
task manager after closing all the application , in the task manager it
still shows 76,476K, Would somebody please explain me why the memory is
not released.
Thanks in Advance
Regards
thomsonOn 25 Nov 2005 21:09:38 -0800, thomson wrote:

> Hi all,
> i have opened my application and did some work, i could see
> i the task manager the Mem usage is 76,476K, I closed my application
> and made sure that no instance of .net is running, but when i saw that
> task manager after closing all the application , in the task manager it
> still shows 76,476K, Would somebody please explain me why the memory is
> not released.
It's not strange at all. You merely have a misunderstanding of the way web
applications work.
HTTP is a stateless protocol. What this means is that there is no way for
the app to "know" if you have closed your browser or not. All it can know
is if you haven't interacted with it in a given amount of time. This
amount of time is configurable in the application pool (under IIS6) or in
other ways under earlier versions.