Showing posts with label projects. Show all posts
Showing posts with label projects. Show all posts

Monday, March 26, 2012

Trouble inserting items from a dropdownlist into a database

Hi I'm relatively new to asp and I'm having a bit of trouble on one of my projects.

Basically I can't work out how to insert an item, that's been selected from a dropdownlist, into a table. I tried:

string queryString; queryString = "Insert INTO Details(Gender) VALUES(";

queryString += "'" + list1.SelectedItem.Value + "')";

However this didn't seem to work and I was wondering what bit of code I had to change to make it insert the selected item from the dropdownlist (list1)

Thanks!

Try list1.SelectedValue.


You should also use parameters instead of concatenating to the end of your SQL string. This leaves your application open for SQL injection attacks.

sivilian

Saturday, March 24, 2012

Trouble understanding StateServer!

I've got a project that is heirarcical in nature.
A security front end, then seperate projects. IE one solution, with mulitple
individual projects underneath.
I get the Unable to make the session state request to the session state
server Error message
I have set the StateServer setting in one of the projects config files. the
others are InProc can i mix and match. Each project is a web application in
its own right. The reason I ask is that if I copy the application and make
an new application at the root of WWWROOT the program works fine.
Any insight would be appriciated.I've sorted it thanks, it looks like it does not like web addresses with
spaces in it. Rename the virtual directory correctly and everything now
works fine.
"Ric Pullen" <Richard.Pullen-REMOVESPAM@.Hospital.nhs.uk> wrote in message
news:usEXjpIcEHA.1144@.TK2MSFTNGP11.phx.gbl...
> I've got a project that is heirarcical in nature.
> A security front end, then seperate projects. IE one solution, with
mulitple
> individual projects underneath.
> I get the Unable to make the session state request to the session state
> server Error message
> I have set the StateServer setting in one of the projects config files.
the
> others are InProc can i mix and match. Each project is a web application
in
> its own right. The reason I ask is that if I copy the application and
make
> an new application at the root of WWWROOT the program works fine.
> Any insight would be appriciated.
>

Trouble understanding StateServer!

I've got a project that is heirarcical in nature.

A security front end, then seperate projects. IE one solution, with mulitple
individual projects underneath.

I get the Unable to make the session state request to the session state
server Error message

I have set the StateServer setting in one of the projects config files. the
others are InProc can i mix and match. Each project is a web application in
its own right. The reason I ask is that if I copy the application and make
an new application at the root of WWWROOT the program works fine.

Any insight would be appriciated.I've sorted it thanks, it looks like it does not like web addresses with
spaces in it. Rename the virtual directory correctly and everything now
works fine.

"Ric Pullen" <Richard.Pullen-REMOVESPAM@.Hospital.nhs.uk> wrote in message
news:usEXjpIcEHA.1144@.TK2MSFTNGP11.phx.gbl...
> I've got a project that is heirarcical in nature.
> A security front end, then seperate projects. IE one solution, with
mulitple
> individual projects underneath.
> I get the Unable to make the session state request to the session state
> server Error message
> I have set the StateServer setting in one of the projects config files.
the
> others are InProc can i mix and match. Each project is a web application
in
> its own right. The reason I ask is that if I copy the application and
make
> an new application at the root of WWWROOT the program works fine.
> Any insight would be appriciated.