What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 26111 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > columnname not passed ...
Dn2010

columnname not passed

Replies: 2 | Posted by: Dn2010 on 4/24/2012 | Category: ASP.NET Forums | Views: 267 | Status: [Member] | Points: 10  


hi friends,

i want to search by table


this query is working(jobs_desc)


Select Row_Number() over (order by jobs_id ) as Row,jobs_id,companyId,jobs_post_date,Client,ProjectId,jobs_desc,jobs_payrate,job?s_remote_part_status From jobs where jobs.companyId =@CompanyId and jobs_desc like(@text)+'%'



i passed parameter @columnname

but its not working,


Select Row_Number() over (order by jobs_id ) as Row,jobs_id,companyId,jobs_post_date,Client,ProjectId,jobs_desc,jobs_payrate,job?s_remote_part_status From jobs where jobs.companyId =@CompanyId and @columnname like(@text)+'%'


please give the solution and please correct the procedure,



this is full procedure



alter Procedure [dbo].jobsearchList (
@PageIndex int,
@NumofRows int,
@CompanyId int,


@columnname varchar(100),



@text varchar(100),
@TotalCount int output )

As
Begin

Declare @StartIndexRow int

Set @PageIndex = @PageIndex - 1
Set @StartIndexRow = (@PageIndex * @NumofRows) + 1

Select @TotalCount = count(*) From jobs WHERE companyId = @CompanyId

If @StartIndexRow > @TotalCount
Begin
Set @PageIndex=(@TotalCount/@NumofRows)-1
Set @StartIndexRow=(@PageIndex * @NumofRows)+1
End

Create Table #tmptable(Row int,jobs_id int,companyId int,jobs_post_date datetime,Client int,ProjectId int,jobs_desc text,jobs_payrate text,jobs_remote_part_status bit)
Insert into #tmptable



Select Row_Number() over (order by jobs_id ) as Row,jobs_id,companyId,jobs_post_date,Client,ProjectId,jobs_desc,jobs_payrate,job?s_remote_part_status From jobs where jobs.companyId =@CompanyId and @columnname like(@text)+'%'



Select jobs_id,convert(varchar,jobs_post_date,1) as Date,ClientName,ProjectName,jobs_desc,jobs_payrate,Case jobs_remote_part_status When '0' Then 'Close' else 'Open' end as Status

From #tmptable
Inner Join Tblclient TC on #tmptable.Client=TC.ClientId
Inner Join Tblproject TP on #tmptable.ProjectId=TP.ProjectId
Where Row between @StartIndexRow and @StartIndexRow+@NumofRows-1 ORDER BY #tmptable.jobs_post_date desc
return @TotalCount
End



***********************************************

declare @ee int;
exec jobsearchList 1,3,31,'','asp',@ee output
***********************************************

thanks.


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Bugwee
Bugwee  
Posted on: 4/24/2012 1:33:34 AM
Level: Starter | Status: [Member] | Points: 25

this returns nothing because the parameter value for the @columnname is empty
declare @ee int;

exec jobsearchList 1,3,31,'','asp',@ee output


change to
declare @ee int;

exec jobsearchList 1,3,31,'jobs_desc','asp',@ee output

Dn2010, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Dn2010
Dn2010  
Posted on: 4/24/2012 2:13:36 AM
Level: Starter | Status: [Member] | Points: 25

thanks,

but i already tried it,

declare @ee int;

exec jobsearchList 1,3,31,'jobs_desc','asp',@ee output

its not working,

please give any other solution,.

Dn2010, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 4:01:01 AM