Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 22nd, 2006, 08:31 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to migarich Send a message via MSN to migarich
Default Dropdown Box problem

Hi all,
I need help with a drop down box in VWD. When designing a web data entry form to an SQL table, i want to select one of the columns( a foreign key field in fact) from a relevant table. I managed to select the foreign key field values but when i post the form it comes back with an error saying you cannot insert anull value into table(Foreign key field table). i DONT UNDERSTAND WHY IT IS NOT RECOGNISING THE SELECTED VALUE.

Please help!!

  #2 (permalink)  
Old March 22nd, 2006, 09:09 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

So what your saying is is that you have 2 tables, the first table holds a foriegn key value back to another table, the values in table 2 are the values that you want to display in your dropdownbox? If this is the case and I assume your fk is the pk of table 2, make sure that the values of your dropdownbox are the pk's of table 2, because those are what you should be inserting into table 1; the error you are getting, for whatever reason, means that the variable you are passing into your INSERT statement is empty.

"The one language all programmers understand is profanity."
  #3 (permalink)  
Old March 22nd, 2006, 10:10 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to migarich Send a message via MSN to migarich
Default

No i dont think i explained well the problem...here i go again:
I have Table ScoutRequirementCompleted which records The ScoutID and The Requirement Code. I also have two other tables which are Scout and Requirement Now on a form i want ScoutID and The Requirement Code to be selected from respectively table 'scout' and table Requirement. I have done that and on the form i am able to select both values from 2 dropdown boxes but when i post them they show error as follows: " Cannot insert the value NULL into column 'Scout_ID', table 'Scouts.dbo.ScoutRequirementCompleted'; column does not allow nulls. INSERT fails.
The statement has been terminated."
It seems the selected value in the dropdown box is somehow not recognised when the form is posted...

Hope this is clearer
Thanks


  #4 (permalink)  
Old March 22nd, 2006, 10:28 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I assume you are declaring 2 variables and setting those variables like so:

Dim intID1, intID2 as integer

intID1 = dropdown1.selectedItem.Value
intID2 = dropdown2.selectedItem.Value

[SQL Statement]

Make sure that you are 1)Calling and assigning the values correctly and 2)that you are binding the data correctly, that is the only reason your INSERT would fail.

"The one language all programmers understand is profanity."
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Property dropdown box in C# code-behind in VS jayaraj123 C# 2005 1 April 5th, 2007 12:54 AM
Standard Dropdown Combo box dartcoach VB How-To 8 November 8th, 2006 10:25 PM
How to integrate search function n a dropdown box jun9nah VB.NET 0 July 24th, 2006 10:12 PM
Changing font in dropdown box Bjoe HTML Code Clinic 4 April 24th, 2006 01:34 PM
Problem with dropdown box Hlybbi C# 5 August 31st, 2004 04:28 PM



All times are GMT -4. The time now is 10:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.