DataSource Controls :: How To Use Cursor In Recursive Sql Function (scalar-value Function)
Apr 25, 2010how can i use cursor in this function ?
ALTER FUNCTION [dbo].[GetCatIDChilds]
(
@CatID [code].....
how can i use cursor in this function ?
ALTER FUNCTION [dbo].[GetCatIDChilds]
(
@CatID [code].....
i am calling a scalar function from a stored procedure. Does using user defined scalar finction has a negative impact on performance.
View 1 RepliesHow do I define @UserName in my function:
[Code]....
I believe "UserName" = Me.User.Identity.Name
but I don't know the proper way to add it to the function.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace amief.Models
{
public class WebsiteModels
{
public static void getPagesForPage(int pageId, dbDataContext db, List<page> myPages)
{
var pages = (from p in db.pages
where p.pageParent == pageId
select p);
foreach (var item in pages)
{
myPages.Add(item);
getPagesForPage(item.pageId, db, myPages);
}
}
}
}
calling the procudure
List<page> myPages = null;
WebsiteModels.getPagesForPage(0, db,myPages);
i'm getting an error System.NullReferenceException was unhandled by user code Message=Object reference not set to an instance of an object. on line "myPages.Add(item);" I don't understand the error...
I am writing a program to crawl the websites. The crawl function is a recursive one and may consume more time to complete, So I used Multi Threading to perform the crawl for multiple websites. What exactly I need is, after completion crawling one website it call next one (which should be in Queqe) instead multiple websites crawling at a time.I am using C# and ASP.NET.
View 4 RepliesCREATE
FUNCTION dbo.ufnGetProductReport(@Pid
int)
RETURNS int
AS
BEGIN[code]....
This is the program. When im trying to execute it with Select * from dbo.ufnGetProductReport(1)
im getting an error Invalid object name ufnGetProductReport
VWD 2008 Express. Visual Basic. SQL Server 2005. I am trying to create a scalar function in SQL Server 2005 wherein I pass a string that respesents a portion of a WHERE clause in the function's SQL statement. I would be passing things like "GDate>1/1/2010 and GDate,1/1/2011" or "Year(GDate)=2010" When I try to build the function it errors out saying basically that the @WhereClause is not a boolean expression. Does anyyone know how I could accomplish this? The part it does not like is in red.
[Code]....
i want to get one value from function using case statement,i tried it but not work
CREATE FUNCTION [FATMS].[fnReturnByPeriod]
(
@Period INT
) [code]....
I have the following sp that uses a scalar function to get the cost of a product
The procedure calculates profit of each bill,and using two tables
1 - Estimate Header
2- Estimate details
For each estimate invoice sp will compare items profit by comparing items rate with the rate it is purchased.I use a Scalar sql Function to get the Purchase Cost of each item in an invoice.This fuction cause the slow execution
Can this scalar function be replace with something else to get this sp execute faster....now it taking around 25 seconds there is only 1100 invoice in the database.
select BillNumber,sdate [Date],case when t1.Customer = 0 then 'Account Payable' else t2.AccountName end Customer ,case when t1.CashOrCredit = 0 then 'Cash' else 'Credit' end CashOrCredit,(select Sum(gross) from EstimateDetails where billNumber = t1.BillNumber)Gross,t1.netDisc,(select sum(TaxAmt) from EstimateDetails where billNumber = t1.BillNumber)Tax,t1.Ces, Amount,t1.roundOff,Paid Payment,
I Getting A Problem In DataGrid's ItemDataBound Event. I Am Calling A JavaScript Function In DataGrid's ItemDataBound Which Retrun The CellIndex And RowIndex Number On Which UserClick After That I Am Re-Binding The DataGrid With jQuery Function After That ItemDataBound Event Not Working. I Want To Call The Same Function Again. Is Their Any Method To Call A Server-Side Function On ItemDataBound Event Except Client-Side Function..
View 4 RepliesHow can I put a SQL Function as 'WITH ENCRYPTION' like you can with a Stored Procedure?
View 2 RepliesI'm on training in a company and i'm making a web application with an SQL server database..Now I created everything but i need to know how to program a search function..t's the point that when I search to a computer it'll put all the pc's with the matching word into the dropdownlist..Like when you search for "A" I get all the pc's wich has an 'A' in their name, I made everything, in the query builder I made a parameter with the textbox but i need not EXACT the value I typed but verything wich has it in it.
View 6 RepliesI need to create a hash key on my tables for uniqueness and someone mentioned to me about md5. But I have read about checksum and binary sum; would this not serve the same purpose? To ensure no duplicates in a specific field.
How can implement this? do I need to write code in my vb application which populates the tables with stored procedures or can I do this from SQL server 2005 studio express?
I have a stored procedure returned a row of data which are written in business layer logics in ASP .net C#. If I bind the data in grid view, I can read the specific cell values from the grid. However, I don't want the grid view visible to the users.
If possible, no data display at all. I only need to save two cell values into variables. how to complete the getProfileValues() function?
[code]....
I have a tbale in database tow tables city and Intrest I need to calculate somethign like this
city1*intrest1 + city2*Intrest2 + city3*intreste3
final result I ned to asing in other column
I want to know if there is a way to create a fuction in SQL Server for the following purpose. I have a select statement that pulls up a list of names from the database based on an ID which is the input parameter for the function. I want to be able to concactinate the values of names got from the query and return a String value.
View 4 RepliesIf I create a new EDMX model and then I import a function, then I can see my function generated in the Designer. If I perform the same process but I add a T4 template (for Self-Tracking Entities) then I loose the function definition, although TT file has code adding a region named "Function Imports". Is this a bug or am I performing something wrong?
View 1 RepliesI have the following query which returns all appointments for a given date, grouped by client and appointment date. For those clients that have multiple appointments on that date, I get multiple rows, one for each appointment time. I only want the earliest appointment for each client, which would result in only one row per client. If I add the MIN function to SchedTime, I'm forced to put all columns in a GROUP BY clause, which isn't what I want.Can I use a derived table and/or MIN(Schedule.SchedTime) to achieve this? Or is my thinking wrong to begin with?
"SELECT Schedule.ClientId, " +
"ClientData.FirstName, " +
"ClientData.LastName, " +
[code]...
Could you teach me how to make girdview pass my object (with all it properties) to my ObjectDataSource delete method please?So far the object received by the delete method has only the datakey value, other properties are null.From this article indicates that this is default behaviour - ttp://www.manuelabadia.com/blog/PermaLink,guid,c72852ae-1fdd-4934-a715-f565ceaf21cc.aspxBut i need the other properties pass to the delete method too so i can do other thing before I actually delete the record.
View 3 Repliesi try to return string value from the function i wrote for getting string value from the table for that i havecommon stored procedure
public string getdata(string str)
{
string datanew;
[code]...
I have this import function which can be changed by the client in his desired way.Now I want to code such that if the client tries to import his own data on the page and doesnot give the tags in the order mentioned below his import function should be stopped.
It shouldn't make any changes unless the tags are in the right format because the problem now is if the tags are not in the right format when client changes then its importing over the existing files and directing to an error page which I dont want it should simply stop the import function if they are nt in the order.the code for this function is below
[code]....
i followed this link [URL] and i get selected value from dropdownlist using jquery
i created 3 partial views .
i need depend's on dropdownvalue redirect to partial page , so how can i implement in jquery with conditions?? or how can i implement in this function Public Function FetchData(ByVal dropdownValue As String) As ActionResult??
I would like to write a function to reuse some functionality that I repeat over and over...
For example:
[code]....
What's changing, in every field, is only the lambda function to get the current field to edit (Name, City, Address, etc...).
What is the best method? Or better: is there ANY method to extract a generic function?
I dont understand why this is occurring, my store pro worked ok before (and i am very sure i am not passing too many arguments to the store pro) but since i have switched to using a "formview"control it has stopped. store pro and ASP.NET with sql data source are shown below. Apologies if the formatting nacks up.
View 3 RepliesI have a problem here.In my database I store member status in 1 and 0, when it come to my gridview I need change 1 and 0 to active and inactive. My company is using Linq, so I must follow. I wrote in this style, I calling a changeToWord() function to change 1 and 0 to active and inactive.
var q=from a in db.members
select new{
mem_name=a.name,
status=ChangeToWords(a.status)
}
It compiles with no error, but when I execute the page, it prompt out a error message to me.