DataSource Controls :: How To Check If Identity_Insert Is On Or Off

Jan 13, 2010

How can I check if IDENTITY_INSERT is on or off for a table in my DB?

View 4 Replies


Similar Messages:

DataSource Controls :: Cannot Insert Explicit Value For Identity Column When Identity_Insert Is Set To Off

Jul 10, 2010

The wierd thing is this was working fine and then it just started throwing this error,

"Cannot insert explicit value for identity column in table 'Reports' when IDENTITY_INSERT is set to OFF."

Here is the code:

[Code]....

View 6 Replies

Identity_insert Error With Foreign Key

Jun 22, 2010

I've got 2 tables where each has a primary key which is also the identifier (Both fields called "id" in each table) In the "picture" table as one of the fields I've got the photoalbumid (The id of the "photoalbum" table). This field is just an int field. I'm getting the following error: "Cannot insert explicit value for identity column in table 'Picture' when IDENTITY_INSERT is set to OFF" Can anyone give me some advise? It's such a basic thing I would hope that there's just something small in the creation of the database that I've missed out. Let me know if you need more info.

View 9 Replies

ADO.NET :: How To Avoid Identity_insert To Set Max Value As Identity

Jan 18, 2011

im using sql server 2008

as per microsoft, [URL]

when i execute the following

set identity_insert on
//insert statements here

set identity_insert off

the identity of the column is set to the maximum value. can i aviod this.

consider the following scenario,

my table has 2 rows as follows

id, name comm
1, John, 232.43
2, Alex, 353.52

now using the above code, when i insert
10, Smith, 334.23

as per the above link, sql server automatically sets the identity to 10. so for newly inserted records(without using identity_insert on), id automatically starts with 11.

i want the identity value to be 3, after using identity_insert on/off

View 7 Replies

DataSource Controls :: Check If Update Has Been Run Or Not?

Jan 13, 2010

I have the following SQL update statement.

[Code]....

What I am looking to do is when I run the srcipt, I want to check to see if this has been run or not. If it hasn't been run then I would like it to update the record, if it has been run then I don't want it to update.

View 8 Replies

DataSource Controls :: How To Check If Record Exists

Jan 6, 2010

Just have a problem, I want people to join a mailing list, I just have a textbox and button. When a user enter's their email address, the address and time are inserted into a database. However, if the same email is added again I would like for a message to appear saying the record already exists.

Can someone show me how to do this, here is my current code:

[Code]....

View 3 Replies

DataSource Controls :: How To Alter A Check Constraint

Jan 6, 2010

Here I have specified a query which gives an idea about how to drop a constraint and recrate it..

[Code]....

Parent_TableName: is the name of the table where we actually reffer.

View 1 Replies

DataSource Controls :: Check For Columns With All Nulls?

Jan 5, 2010

I have a situation where a query returns ~20 columns, but at any given execution only 5 of the 20 will have non-NULL values. The remaining 15 will contain null for every row in those columns.

I need to figure out which of the 5 columns have values. I am using a SqlCommand. How would I best approach figuring out these 5 columns?

View 5 Replies

DataSource Controls :: SQL And Linking 2 Tables To Check Value?

Apr 12, 2010

i have a job application process where users apply for a job, in the admin section administrators want to be able to see which applications have not been viewed. Now i have one page which lists all the job vacancies and then users can click into that specific vacancy to see which people have submitted an application. This all works fine.

However on the page i display the job vacancies i need to make it so that if there are any applications within a vacancy that need viewing it appears in RED.

The two tables i am using are below:

tbl_vacancies
job_id
job_name
location
voucher
details
availability
region
date_added
tbl_applications
application_id
job_id
fname
sname
other_info
.
.
.
.
date_addedd
viewed

Now the viewed column is in tbl_applications table, the applications relate to a specific vacancy via the job_id.

So what i need to check is IF there are ANY applications where the viewed = 0, if so that means that there are applications that need to be seen, and i want this to appear in RED.

Now i tried this several ways i.e an INNER JOIN etc.. but the full list of vacancies won't appearing.

So i tried this:

[Code]....

[Code]....

This doesnt work at all. I have a datareader which runs through the returns, i don't get any errors, and the applications display correctly but when i use the IF to check it doesnt work..

View 2 Replies

DataSource Controls :: Iterate Through Rows To Check If Row Has Been Displayed?

Jul 9, 2010

I am having a problem. I need to check to see if a row has been displayed once, and if so don't display it again. I have the following code:

[Code]....

This all works perfectly, but displays the body row repeatedly. So i need to add a counter or something to check this and make sure it is only displayed once..

I tried with DISTINCT in the sql but that didn't work, so i think it may be better doing it through iteration? Can this be done?

View 11 Replies

DataSource Controls :: Check For Duplicate When Adding A Record?

Jan 30, 2010

I have webform which has insert button to insert/Add new record into my database table. It works fine but the problem is that I have a unique field name of the field is txtQuotes ,The user should not be able to insert a record that contains the same value for that field.How can I check for duplicate?

View 5 Replies

DataSource Controls :: How To Check For Both Empty And Null Fields

Jan 28, 2010

How do I check if my value is empty AND Isnull? I need to check for both, using ISNULL is not enough because the data can change just so that it is empty.

how I can change my query to accommodate this?

[Code]....

View 5 Replies

DataSource Controls :: Is It Possible To Check If A Sqlparameter Exists Before Adding

Apr 17, 2010

I want to check if an sqlparameter exists before adding a new one so I don't get the error - @param was supplied multiple times. IS this possible?

View 7 Replies

DataSource Controls :: Check If The Particular Values In A Table Exists?

Jan 5, 2010

how to check if the particular values in a table exists?

if it is not existing i need to insert that values in the table?

View 4 Replies

DataSource Controls :: How To Check That Data Reader Is Null

Jun 4, 2010

[Code]....

but if table is empty i.e. there is no record for Store_no=storeno then it bill_id = (Convert.ToInt32(reader[0]) + 1); give a Null exception.

I want to set bill_id=1 if there is no previous record in table of that particular store number. then How to do this.

i.e. How to check that reader[0] is null

cmd1 = new SqlCommand(" Select Max(Bill_No) From Bill_Record Where Store_no='" + storeno + "'", hookUp);

View 3 Replies

DataSource Controls :: How To Check Two Queries Return Result Is Same

Feb 26, 2010

how to wrote stored procedure for check two queries result this result is same return true value its not same return false value

View 2 Replies

DataSource Controls :: How To Check Connection With Data Base

Apr 24, 2010

how check connection with data base? Now I all query put in try and catch. But I need to check only is access to data base

View 1 Replies

DataSource Controls :: Check The Values Entered Against A Database?

Mar 10, 2010

I have a webform, that needs to check the values entered against a database, and then send an email if the request turns out positiv.

View 11 Replies

DataSource Controls :: Check Query Return Value Or Not In LINQ

Jun 2, 2010

i have a Linq query that check something in database

after that i want to check if record find in database or not

dim re = From r in db.mytable _
where r.ID = _ID
Select r

how can i check the re return somthing or empty

View 1 Replies

DataSource Controls :: Need To Check To See If Any Data Has Been Returned From The SQL Query?

Apr 15, 2010

I am trying to run the following SQL query

string strConString = ConfigurationSettings.AppSettings[ "conString" ];
myConnection = new OdbcConnection(strConString);
myConnection.Open(); // open connection
string strSelect= "select * from tbl_howells_product_data where title like" + "'" + strsearch + "%" +"'" + "order by product_id asc";
OdbcCommand myCommand = new OdbcCommand(strSelect, myConnection);
dtrReader=myCommand.ExecuteReader();

The problem is I need to check to see if any data has been returned from the SQL query, if there are no rows/ data returned by the query then I need to display a message to say that there aren't. I know that there isn't a 'number of rows method' for the dtrReader, so does anybody know how I could do this?

View 3 Replies

DataSource Controls :: Check Today's Day Fall Between From And To Date?

Jan 18, 2011

what is the best way to check today date come between from and To date. I am using below but it is taking too much time, but when i remove this condition it returns in 1 second.

getdate() BETWEEN a.ValidFrom AND COALESCE(a.ValidTo,getdate())

View 8 Replies

DataSource Controls :: Check Constraints Are Applied Only After A Commit?

Apr 9, 2010

I have a multi- statement transcation in my stored procedure, that is either inserting or updating records in table1 and table2.

table1 has a check constraint. Will the check constraint be checked only after I call COMMIT in above transaction, OR will it be checked before I call COMMIT when using INSERT or UPDATE statement?

View 5 Replies

DataSource Controls :: How To Check The Return Code Of A Stored Procedure

Mar 24, 2010

When it is bound to a datagrid. I do a grdELTCompletions.DataBind() and it shows that it's SELECTING, but returns nothing. I can execute the SP in MS SQL and it works fine. I just need know what elements of either the datasoure (sql to execute the SP) or the datagrid to find the error. Or even if there is a SQL log I can look at..

View 6 Replies

DataSource Controls :: How To Check And Update Duplicate Record In DataTable

Jan 13, 2010

my requirement is to update a duplicate record in datatable.in my website if anyone select a product more than one time then i have to check and update the quantity of that record.i use for loop for this but it is not working properly, it is running perfectly for one product but when i add another product it won't work.how can i do this?Here is my code part which is run on add button click

if (sc.dtcart.Rows.Count > 0)
{
for(int i=0;i<sc.dtcart.Rows.Count;i++)

[code]...

View 2 Replies

DataSource Controls :: How To Check Two Date Columns In Sql If Dates Are Same Then Select One

Apr 6, 2010

i have DateFrom and DateTo columns in tblLOgs.if they both are same then select only DateFrom else both selects.my procedure is ....do modification in them

[Code]....

View 6 Replies







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