Assign a foreign key as a parameter

hi everybody

I have the following asp.net2.0 code

SelectCommand = "Select IDEmp, FirstName,MiddleName,LastName, Date,HoursNumber, Description

From Employee, WorkOnCategory , CatDesignItemReference

where IDEmp =IDEmplWork AND FirstName = @FirstName AND Category = @AnyCategory AND ">



<asp:ControlParameter ControlID="txtEmployeeName" DefaultValue="" Name="FirstName" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="DropDownList1" DefaultValue="" Name="AnyCategory" PropertyName = "SelectedValue" Type="String" />





The problem is that the AnyCategory in my DropDownList1 refers to a key but unfortunalely my code understand it as string so it assigns

 Category = @AnyCategory  as if Category ='AnyCategory ' not as Category = AnyCategory 

 So what should I do


10/15/2007 8:39:57 AM 91979 articles. 4 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 53

Try changing the Type property of the AnyCategory ControlParameter from String to Int32


Mike Banavige

Need a site code sample in a different language? Try converting it with:
10/15/2007 8:43:27 AM

Similar Artilces:

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Can we get the foreign row from a given parent row using foreign keys instead of datarelation
When we define a foreign key in 2 tables. When the user chooses a row in the primary table, Can we get the foreign row automatically from the Lok up table using the foreign key that we defined instead of datarelation. Do u have a little code example. ThanksThanks a lot, I appreciate your taking the time to help me. Foreign key is a kind of constraint on tables, which is used to engage for data consistency at data storage level. That is different to DataRelation, which used to relate two DataTable objects to each other at data accessing level. And your requirement is related t...

Table design question (to foreign key or not to foreign key)
Our application is a message board and is full of messages, threads, and forums. A message is an individual entry (like the one I'm typing now ;)). Our software gives the user the ability to upload a single file attachment to each message. I can think of a couple different ways to design the two tables: message( messageid numeric identity, attachmentid numeric null, messagetext text, other, message, stuff... ) attachment( attachmentid numeric identity, title varchar, other, stuff ) or message( messageid, messagetext text, other, stuff ) attachment( messageid numeric foreig...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Get Foreign key in a FieldTemplate
Hi, I've the following problem: In the database, i've a Products (productid,productname) table and a Pictures (pictureid,productid,pictureurl) table. There's a foreign key in the Pictures table, (Products.productid -> Pictures.productid). I've created a custom FieldTemplate, where I'm uploading the file to a webservice, which is working as expected when in Update-mode; however on Insert there's a problem when the user just clicks the "insert new" link on the bottom, there's a Dropdown with the possibility to select a product. Q1: how can I ge...

Getting started
Starting an ASP.NET project (in C#) and wanted to pose a few questions to those of you with experience of whipping-up solutions. There are a few key areas which are fairly unrelated, but which pose a slight hurdle in my initial thinking of how to put a project together... 1. From what I gather, the db connection string should go in the web.config. I'm told not to place the user/pass in plain text there though -- even though no one has access to this file. If I'm to encrypt it, I presume I then need to unencrypt it before use, right? This the best place to put the conn str? 2. Global ...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also, but then, I might be a little prejudiced David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

Assigning foreign keys in code.
I am quite new, and though I have purchased and viewed several videos, I cannot figure out the answer to this embarrasingly simple data problem.  I have changed the names of the 2 tables and fields for ease.  This is all for a button click event: SqlDataSource1.InsertCommand = "INSERT INTO [orders] ([o_detail1], [o_detail2]) VALUES (@o_detail1, @o_detail2)";SqlDataSource1.InsertParameters.Add("o_detail1", textbox1.text);SqlDataSource1.InsertParameters.Add("o_detail2", textbox2.text); SqlDataSource1.Insert(); // The above code works fine. ...

Getting Started with .net and a few questions
Hello I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add ...

Getting started with JScript.NET
I'm a Javascript and Actionscript developer, and the thought of being able to do server-sides in something I know was too good to resist. Does anyone know some good tutorials for developing ASP.NET pages in JScript?  I can find lots of console code, but simple things are hard: like I can't even figure out how to print something out to the web page (just a string). What I'm really trying to do is access a database, verify a login, and print JSON out to the response.  What should I do to start?  Is there a better way to do this? (IE: using some JSON library already?). I'm commun...

How do I get the parameter for the delete command when I get the parameter for the select in another way?
I'm working with VS 2008.  I've got a data grid control, which I populate through a DropDownList that is data bound using a stored procedure.  When the DDL changes it updates the contents in the DataView control.  The DataView control is also data bound, and is populated using its own stored procedure and the code returned from the DDL once the user selects something.  I've got another stored procedure assigned to the DeleteCommand of the SqlDataSource, which I intend to use is with a delete CommnadField of the DataView control.  However, in this case I w...

Foreign key to other table, with foreign key back to first one: ok?
Is it ok for two tables to have foreign keys to each other based on the same columns? If so, are there rules about the cascade settings in such a case? I am thinking of tables that are virtually one-to-one with each other and can tend to be viewed or deleted equally "from either end". -- Steve The first problem I see with this is that it is a "which came first, the chicken or the egg" type of a problem. When you insert into one table the FK is going to want to check to see if the value is in the other...

Web resources about - Assign a foreign key as a parameter -

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google / Firefox Parameter - Flickr - Photo Sharing!
HS what?

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 12/26/2015 7:20:36 PM