how to pass field value to another field

how can i take an id field value from one table and insert it to a field in another table? my insert for document is this:

const string sql = "INSERT INTO document(doc_id, doc_name) VALUES(doc_id, doc_name)";

my insert for staff data:

success = (int)ApplicationBLL.InsertData(staff_name, staff_loc);

each staff must be linked to one document. therefore i have staff_id in both tables. staff_id (pk with identity seed) in staff table and staff_id in document table. But when i run application it says cannot insert null into staff_id in document. could I hardcode it to pass staff_id from staff table to staff_id in docuent table?

thanks!

0
Dilal
1/30/2009 12:52:47 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
791 Views

Similar Articles

[PageSpeed] 5

Hi,

first u select for which staff u want to insert a document and then specify that staff_id in the insert query of document.

Thanks
Panna
Thanks
Panna
0
panna_sn
1/30/2009 1:33:14 PM
Reply:

Similar Artilces:

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

Submitting Web forms fields to sql database by clicking on SUBMIT FORM and sending the form fields to email box
I have a created or designed a form to be stored in a SQL database table and at the same time when a user clicks on SUBMIT button the form fields will automatically goto the visitor email address immediately. Also i have created a database with tables for each of this forms Pls help i have over 10 forms designed but the problem of submitting them to the table database and the user email address is the challenge now.... You ned to familiarise yourself with the basics of database access in ASP.NET.  There are free tutuorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/da...

Selecting value in one field then causes value in another field to be selected.
I have a web form which contains a date field, the date is populated using a DatePicker which is Javascript based. The form also has a drop down box containing 3 values. What I want to do is when a date has been selected that this will cause the dropdown list value to change to dated which is one of its 3 values. i.e. when the date field is not blank then the value will be selected in the dropdown. What I also want to happen is when the date has been selected and the dropdown value is dated then the date field and the dropdown field will be set to read only.Anyone any ideas how to this usin...

Pass a form field value from one page to another and fit it into a Sql query
Hi all  I'm trying to do the following and hope you can help 1 User selects a value in a dropDownList(Scheme) on Page1 and then clicks Next button which has a PostBackUrl of Page2 2 on Page2 collect the value that was submitted from Page1 and use this value to query a database. e.g. select * from databasetable where SchemeID = (the value of Scheme Passed from Page1) Anyone know how I can achieve this? regards Chubster  it wasn't me, a big boy did it and ran away Hi Chubster, Using cross page postback, access the PreviousPage property of Page2 to retrieve values f...

Passing Web Form TextBox value to a SQL Server 2000 Table column field
Community, I am trying to pass a text box value to populate a table column called LastName - see below - using the Update command.  When the below code executes from the Web Form, 'LastName.Text' populates the table column.  I, of course, want the value in the txtLastName.Text field.  Any advice is appreciated! Dim strSQL As New SqlCommand("UPDATE Clients" & _ " SET LastName = 'txtLastName.Text' " & _ " WHERE AccountID =" & txtAccountNo.Text, scnnNW) Rob H. Change: " SET LastName = 'txtLastName.Text' " & _ to " SET LastName...

populate a field with another field value onclick event
On ButtonClick, I want the hidden field orderValue to read the value from Amount. The above alert statement is correct but when I write the document.Test.orderValue.value tot he database it inserts a blank field. When I view source files, the value from OrderValue is still blank. Pls assis in how i resolve this function ClickEvent() { if (document.getElementById('btn').onclick) { document.Test.orderValue.value = document.Amount.value; alert(document.Test.orderValue.value); } } <form name="Test"> <input type="hidden" name="o...

Hiding a hyperlink field if another field has a certain value
Hello all,I have a GridView and in it is have a bound data field and a hyperlink field.  The data field provides status information on data and when that data reaches a certain stage i want a hyperlink to be available in the hyperlink field.  The hyperlink cannot be there any other time.This is what I have tried already... Protected Sub grdvCPBatches_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdvCPBatches.RowDataBound If e.Row.Cells(4).Text = "Not Uploaded" Then e.Row.Cells(5).TemplateControl.C...

HT do a simple field update based on value in another field...
All- Please help with what must be a simple SQL INSERT solution (VB please): Supposing I have detailsview that is the interface for a table that has at least these fields: record_id (smallint, autofilled by db)some_boolean (int)id_copy (smallint) Of these fields, the user is prompted only for a value for the some_boolean field. The functionality I'm looking for: If the user sets some_boolean to true (eg, checking a checkbox) and then clicks Submit, I would like SQL INSERT to copy the record_id that is assigned to the record to the id_copy field. If some_boolean ...

passing a value to a hidden form field
Hi Newbie Question: I have a dataset called "mxdata" that has a field called "mxorder" with an integer value. I want to increment that value by 1 and pass the new value to a hidden form field. ie: variablex = mxdata.mxorder + 1 <input name="ordervalue" type="hidden" id="ordervalue" value="<%# variablex %>"/> Obviously this is incorrect. Can someone show me how I would do this? why not just add it to the viewstate?, the ultimate hidden field of all time :-) ViewState("orderValue") = mxd...

How do I populate a form field based on the value entered in a different field
------_=_NextPart_001_01C6DF64.FB6BF38A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi folks, I'm trying to create an HTML form that will refresh itself based on user input. In the POD for CGI it says that you can set the value of a named parameter by using something like: $query->param(-name=3D>'foo', -value=3D>'the value'); But it doesn't say (or at least I didn't see) anything about how to redisplay the form with the new value in the textbox (or a different textbox for that matter...

linking a sql field to point to the value of another sql field
is it possible to create hyperlinks in powerbuilder such that if you retrieve two fields from a database.. and want to display the first field on the screen and have it link to the value of the other field (when clicked) which is actually a URL address, you can? any help will be appreciated. thank you! ...

RE: How do I populate a form field based on the value entered in a different field
Would you mind sharing the answer? I would assume it would have to be some sort of Javascript, am I wrong? Thanks, Shawn -------------------- Shawn Michael Hinchy shawn@hinchy.net ...

RE: How do I populate a form field based on the value entered in adifferent field
=20 -----Original Message----- From: Shawn Hinchy [mailto:shawn@hinchy.net]=20 Would you mind sharing the answer? I would assume it would have to be some sort of Javascript, am I wrong? Thanks, Shawn -------------------- Shawn Michael Hinchy shawn@hinchy.net Nope, no Javascript. I could have used JS, but I was looking for a server side solution, due to having to replace values in a textfield with values gotten from a database in my "real" project. I'm embarrassed to admit that it all boiled down to having a statement out of order. Here's the fina...

CGI: How do I populate a form field based on the value entered in a different field
------_=_NextPart_001_01C6DF3D.236D5557 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi folks, =20 I'm trying to create an HTML form that will refresh itself based on user input. In the POD for CGI it says that you can set the value of a named parameter by using something like: =20 $query->param(-name=3D>'foo', -value=3D>'the value'); =20 But it doesn't say (or at least I didn't see) anything about how to redisplay the form with the new value in the textbox (or a different textbox for th...

Web resources about - how to pass field value to another field - asp.net.web-forms

S.E. Cupp: Obama’s Speech Did More to Attack Republicans than Islamic Terrorists
During a discussion on Obama’s address last night on San Bernardino and Islamic extremism, CNN commentator S.E. Cupp joined the chorus of those ...

Chicago PD Releases Video of Another Fatal Shooting; No Charges Filed Against Officer
The Chicago Police Department today released a video of another fatal shooting of a young man by a police officer. In the wake of outrage in ...

The 2016 Grammys Are Gonna Be Alright
This time last year we were perturbed with the Grammys for generating a slate of 2015 nominees that honored a bunch of mediocre white musicians ...

Every new ‘Star Wars: The Force Awakens’ detail revealed at this weekend’s press event
We're less than two weeks away from the release of Star Wars: The Force Awakens , and excitement over the highly anticipated sequel has reached ...

Hillary Clinton Writes About How She'd "Rein in Wall Street," Still Doesn't Support Glass-Steagall
Hillary Clinton: Out today with another promise to "rein in Wall Street," still not a fan of Glass-Steagall. JStone / Shutterstock.com Today, ...

Dropbox announces plans to shutter its Mailbox and Carousel apps
In somewhat of a surprise, cloud storage company Dropbox announced that it is shutting down its Mailbox and Carousel apps. Mailbox, which focused ...

Google enables Safe Browsing by default on Chrome for Android
Google has taken steps today to ensure Chrome users accessing the web on Android are better protected by turning on Safe Browsing by default. ...

Venezuela's opposition trounces Socialist party founded by Hugo Chavez
The Democratic Unity coalition won 99 seats to the Socialist party's 46 in the 167-national National Assembly, the election board said, with ...

FBI Questions Alleged 'Assault-Style' Weapons Buyer
Officials: Years ago Enrique Marquez bought guns used in massacre.

Kim Kardashian Announces New Baby’s Name on Twitter
Yesterday, Kim Kardashian took to Twitter to announce that her and Kanye West's second child was on it's way.

Resources last updated: 12/7/2015 8:56:35 PM