Monday, March 12, 2012

How to handle NULL fields-error with fill method

I have a data adapter that is using a stored procedure and when I get to the fill method to fill a dataset I get the following error
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
The results of the procedure has 6 columns by 50 rows with some NULL field values throughout so think the NULLs are causing the problem. Just wondering how to handle this? Thanks Paul.Fixed this problem. Since a change was made to the procedure, reconfiguring the data adapter cleared the problem.

Labels: , , , , , , , , , , , , , ,

how to handle bulk data in gridview

HI

I am having a gridview in a web application. for a search my stored procedure returns more than 30 thousands of records sometimes.

I am not using any direct connection from gridview to databse. i am fill the dataset by executing the stored procedure. If it's a direct connection it will bring few records to fill the first few pages and once we navigate , it will bring another set of data. (my page size is 1000).

how can i handle this? is there anyway to bring few data to dataset and once we navigate to another page we can bring next few 1000s records?

Regards

K.Anvar sadath

Hi Anvar,

You need to use custom paging in Gridview. Please check out this article:

http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

Hope this helps.

Labels: , , , , , , , , , , , ,

How to handle a "stored function" ?

I handled a "stored function" like a "stored procedure" and got the exception:

"The request for procedure 'XY' failed because 'XY' is a function object."

Can someone provide me example code how to handle "stored functions" ?


I think you are talking about user defined functions.

If so - udf's are not callable directly. Try this: "select XY (... )"


You are right - with "select XY(...)" I get "XY is not a recognized function name". What is missing?
You may need to do SELECT dbo.XY(..)

where dbo is the database owner that created the function.

Hi,
I am not sure if this example solves your problem.
Notice the owner before the function name.
SELECT dbo.DateOnly(GETDATE())


HI,

Or if your function returns a table as a result the you can use it like a normal table:

SELECT * FROM dbo.MyFunction()

cheers,

Paul June A. Domag

Labels: , , , , , , , , , ,