DataSource Controls :: Returning Primary Key Of New Database Row

Jul 9, 2010

In my application, users fill out a form to submit a "Job Request" - once they submit the form it is stored as a new row in a table in the Sql database. Each "Job Request" that is submitted is given a "JobID" which is a number and also the primary key of the new row in the database (the number is generated by the database). Once the users hit the "submit" button, I'd like to return the value of the "JobID" (the primary key) so that the user can know what it is. How would I achieve this? In the future, I will have to expand the application so that the users would be able to edit an older "Job Request" and get a similar JobID number (so if before it was 1234, the new one would be 1234-1 or something like that), so this is not simply a matter of searching for the highest number in the primary key field in the table and returning that. I'm using Sql for my database and writing in VB.

View 1 Replies


Similar Messages:

DataSource Controls :: Recovering Data Form SQL Server Database Primary Data File?

Jan 18, 2010

I have SQL Server Database Primary Data File.

I want to recover the data from that file in to my data base which has the empty tables.

I have Microsoft SQL Server Query File which contain the table structure.

View 1 Replies

DataSource Controls :: Procedure Returning No Data Even Though Data Is Present In Database?

Jun 21, 2010

iam using asp.net2.0 with c#, with backend sql server2000

in my client system i have to create dynamically procedure and return the result

but when iam using in my local system the code is working fine but at client system it it not working

[Code]....

View 5 Replies

DataSource Controls :: Change The Primary Key Value?

Jan 4, 2010

Let's say I have a table that holds information about books, with a column called bookid as a primary key with auto increment of 1. When I create a couple of records, it assigns 1 to the first row and 2 to the second row for the bookid column. If I delete the second row and enter another row, even though table now only has 2 records, the primary key column says 1 and 3 for their bookids. Is it possible to change back the bookid of the second record from 3 to 2 or is it just server assigned and can't be changed.

View 9 Replies

Forms Data Controls :: Values From Multiple (non Primary And Primary) Datakeys?

Mar 6, 2011

I have the following gridview (ID=Gridview1)

I have added pid (primary key), chkblood,chkurine,chkstool,chkmalaria as datakeynames.

what I want to pull off here is .... when I click select I'll be redirected to this wizard

[Code]....

I did that....now I want to hide / skip steps in the wizard depending on the condition of checkboxes (chkblood, chkurine,chkstool,chkmalaria)

but I cant get the value from these non-primary datakeynames...

View 2 Replies

DataSource Controls :: Dml For Primary And Foreign Key Tables?

Jun 3, 2010

how i insert,update and delete data in multiple table .such tables in which primary and foreign key constraint are

View 1 Replies

DataSource Controls :: Datatype Of The Primary Key Which Should Never End Bigint?

May 10, 2010

Yes..i know this is ASP.NEt forums but the SQL server doubt i will be going to ask is related to ASP.NET

I have a table 'a' in my database where i store User information - each time they visit the website a new record is added

so in a high traffic website - the information will be collectively huge(i dont care about this as i have too much of disk space)

but the problem here is with the primary key - I want a datatype of the primary key which should never end Bigint can store some zillions of records but it finally ends... how will i be able to accomplish it.

View 8 Replies

DataSource Controls :: Inserting Primary Key Automatically?

Jan 19, 2010

My codes below are to insert a new data into the database. The thing is, this code can insert the primary key(DeviceID) into the database automatically but I cant seem to find the code to insert the primary key into the database. point me the statement that insert primary key(DeviceID)..

This is the snippet of the submit button event

Protected Sub SubmitDevice_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitDevice_Button.Click If Session("canUploadBool") = False Then ClientScript.RegisterStartupScript(Me.GetType,
"canuploadScript", "")
Exit Sub
End
Dim insertNewProcess As String = "INSERT INTO Device_Table("
Dim deviceColumn As String = "DeviceRevision, CustomerName, CustomerCode, CustomerResponsibleEngineer, Date, DevicePartNumber, PackageType"
Dim deviceValue As String = ") VALUES ('01', '" + CustNameDropDownList.SelectedValue.ToUpper + "', '" + CustCodeLabel.Text + "', '" + CustomerResponsibleEngineerTextBox.Text.Trim.ToUpper + "', '" +
Format(Now, "dd-MMM-yyyy").ToUpper + "', '" + DevicePartNumberTextBox.Text.Trim.ToUpper + "', '" + PackageTypeTextBox.Text.Trim.ToUpper + "'"

View 4 Replies

DataSource Controls :: Make A Three Primary Key In One Table?

Jan 3, 2010

i have to make a three primary key in one table

View 2 Replies

DataSource Controls :: How To Get The Primary Key Of The Newly Inserted Record

May 10, 2010

I am using a FormView to populate data, then inserting it using a LinqDataSource. The primary key is an autoincrementing identity. I'd like to handle the ItemInserted event to update some other tables, but I cannot find how to get the primary key of the newly inserted record. The insert happens fine, but nothing for the PK.

I realize I can change to using a SPROC, or change to creating the new row and doing the insert myself, but I'd prefer to continue with the LinqDataSource's automatic insert.

How can I get the PK?

View 2 Replies

DataSource Controls :: LINQ / Insert Records Without Having Primary Key?

Apr 29, 2010

I am using LINQ Expression to insert records in SQL Table. My Table dosen's have any Primary Key Field. Whenever I Am trying to Insert Records in Table using LINQ Expression, this always occurs an Error that 'the Table You are using to insert Dosen't Have Any Primary Key Field.

How I Will Insert Records Without Having Primary Key ?

View 1 Replies

DataSource Controls :: Automatically Insert Uniqueidentifier In Primary Key Attribute?

Feb 14, 2010

When a user creates an account for my web application using the create user wizard additional steps have been added to take more details and store them in another table. Now this tables primary key is set to uniqueidentifier, is it possible to have that unique identifier automatically generated when the query is run to insert a new row for a new user?

View 1 Replies

DataSource Controls :: Using Views With EntityFramework Is Not Able To Recognize Primary Keys

May 2, 2010

Cannot seem to find a good fit for my question so I will ask here.

Does Asp.Net 4.0 solve the problems with using Views with EntityFramework is not able to recognize primary keys.

View 2 Replies

DataSource Controls :: Error 3033 : Their Primary Keys May Collide

Jan 15, 2010

I have started my new mvc project with entity framework,Must say it is very diffcult to work with entity framework.

"I am trying to create new custom entity in .edmx file,Now i have made one column as Entity key,Which is already entity key another entity set."

"Error 3033: Problem in Mapping Fragment starting at line 3081: EntitySets 'Entityset name' and 'Entityset name' are both mapped to table 'Entityset name'. Their Primary Keys may collide."

View 8 Replies

DataSource Controls :: Attribute To Be The Foreign Key Which Is Not A Primary Key In The Original Table?

Jul 2, 2010

attribute to be the foriegn key which is not a primary key in the original table?

View 1 Replies

DataSource Controls :: Deleting All Child Record On The Base Of Primary Key And Foreign Key?

Apr 20, 2010

how can i retrieve the all foreign keys against a single primary key. i mean to say that if a table contain a primary key then it becomes as foreign keys in which tables.

i want to take that nam of that tables and on the base of that tables then i am to delete from all the entries. e.g: if a primary key's column entry deleted then all foreing key entries should also be deleted.

there are 988 tables in a single database. it can't be possible to go for each table to setup foreign key to ON DELETE CASCADE.

.can it have any way to delete against foreign key priority wise? mean to say that parent table contain primary key, child table contain foreign key , now there is another child table which dependent previous child table. then how can i delete all record against it?

i want to do it from programatically. i am using sql server 2005

i have completed this till to that , it retrieves all foreign keys but how to delete now on the base of priority.

[Code]....

View 1 Replies

DataSource Controls :: Insert Sequential Numbers Into A Primary Key Column Using A Script?

Jan 29, 2010

I need to insert multiple records using a script.

My table is

Region
(
ID int,
Name varchar(50),
Description varchar(51)
)

One thing I can use is to retrieve the max(ID) from region and store it in a variable and increment the variable sequentially and insert. But, if any other user inserts a record while I am executing this script then max(id) might clash with the id inserted with other user causing my script to fail.

Is there any other option to insert record sequentially base on the highest number in the table.

View 3 Replies

Forms Data Controls :: Compare Integer Value To Primary Keys Of A Detailsvew Datasource?

Mar 8, 2010

I have a textbox that takes an integer value, and a submit button that when clicked passes the value to a detailsview to display the database record at that index.

What I'd like to do is, when the button is clicked, compare the number to the keys in the detailsview's datasource so that if the record ID doesn't exist, I can display a label telling the user that the ID# doesn't exist.

How would I go about doing this? Is there some sort of compare method for the datakeynames property?

View 6 Replies

DataSource Controls :: StoredProcedure Returning Zero Instead Of Value?

Feb 2, 2010

My stored procedure is returning zero....can anybody correct me....Stored Procedure -

[Code]....

Fucntion calling SP -

[Code]....

tell me where i went worng and correct procedure too....table hase 4 rows....so count should return 4..

View 8 Replies

DataSource Controls :: Returning A New Line In SQL?

Jul 6, 2010

I have the following SQL Statement:

SELECT ('Ref:' + ' ' + PT.REF + CHAR(13) + 'Details:' + ' ' + PT.PAYEETRANSTYPE) AS TRANSREC, PT.REF, PT.PAYEETRANSTYPE,PT.PAYEEACCNUM, PT.PAYEETRANDETAILS,PT.STATUS FROM PAYEETRANSACTION PT

The TRANSREC column as shown above has 2 details: Ref and transtype. I would like to separate them into 2 lines as followed:

Ref:
Details:

Currently, it is shown as " Ref: .... Details: .... "

I have tried using CHAR(10) and CHAR(13) , but cannot.

View 6 Replies

DataSource Controls :: Stored Procedure Not Returning Value

May 15, 2010

I call this stored procedure with a dataset. It always returns a 0 but should return a 1 or 2. Does anybody know why it isn't returning a 1 or 2.

ALTER PROCEDURE dbo.sp_InsertLinkVote
@LinkId int,
@LinkVoter nvarchar(50),
@LinkVotesDateTime datetime,
@LinkVotesGoodBad bit
AS
/* SET NOCOUNT ON */
 
If EXISTS
(SELECT
*
FROM
LinkVotes
WHERE
LinkId=@LinkId
and
LinkVoter = @LinkVoter )RETURN
1
ELSE
INSERT INTO
dbo.LinkVotes (LinkId,LinkVoter,LinkVotesDateTime,LinkVotesGoodBad)VALUES
(@LinkId,@LinkVoter,@LinkVotesDateTime,@LinkVotesGoodBad)RETURN
2

Here is were a call it in my code behind.
Dim VoteCheck
As
Integer
Dim InsertVote
As
New DataSetStoredProceduresTableAdapters.QueriesTableAdapter
VoteCheck = InsertVote.sp_InsertLinkVote(LinkId, User.Identity.Name, DateAndTime. Now,
True)
'0 is a good vote.
If VoteCheck = 0
Then

It seems to insert and not insert correctly, I just cannot get it to return the correct value.

View 4 Replies

DataSource Controls :: Returning Value From Stored Procedure

Jun 23, 2010

I am developing a page in ASP.Net where I have the user enter a letter into a textbox. They then click a submit button and I all of the userids that start with that letter are to be displayed. So I need the SP to go through the database and match first letters with what was entered. Here is what I have as my code for the SP:

CREATE PROCEDURE dbo.exp2 @testchar Char(1)
declare @flag as char(2)
set @flag = @testchar + '%'
select userid
from ex_database
where userid like @flag

View 6 Replies

DataSource Controls :: Returning Null Value From Procedure?

Jun 17, 2010

[Code]....

iam using asp.net2.0 with c# with sql server 2000 when iam executing the procedure in local system it is working fine.but when iam executing in client system procedure returns null value, i have checked all connection string , and session value all are working

View 1 Replies

Data Controls :: Slow Loading Page In Primary Key For Next Loaded Data - Primary Key Not Show Properly

May 7, 2015

I am working on lazy loading page the problem is

when i bind first time page (10) records then primary properly bind with records and when my next 10 records load using lazy loading then the primary key not change it shows 1st records primary key

check the below code in which i am assigning assetid (primary key) but its not assigning properly...

function OnSuccess(response) {
//alert('testing');
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var customers = xml.find("AssetSummary");

[Code].....

View 1 Replies

DataSource Controls :: TableAdapter.Update Returning Incorrect Row Ids?

Apr 9, 2010

I'm lost as to where to look next. Here is a sample of what I'm doing:

[Code].... The related tableadapter insert statement was autogenerated by VS2008:

INSERT INTO [ProductCycleCountItem] ([ProductCycleCountLocationID], [ProductID], [CountOnly], [Status]) VALUES (@ProductCycleCountLocationID, @ProductID, @CountOnly, @Status);
SELECT id, ProductCycleCountLocationID, ProductID, CountOnly, Status FROM ProductCycleCountItem WHERE (id = SCOPE_IDENTITY())

With multiple users it's as if it was returning @@IDENTITY instead of SCOPE_IDENTITY(). The table will look like this:

id Location product

1 A 5321

2 A 8273

3 B 2827

4 A 1743
The returned dataset will look like this:

id Location Product

1 A 5321
2 A 8273
3 A 1743

Is it maybe a SQL Server (2005) setting that's incorrect?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved