Posts

Showing posts from February, 2016

create the Store Procedure create Dynamic Query and Paging

Here we Create Store Procedure For the Create the Dynamic  Query and also paging and also insert data when page no is first Create Procedure Gia_Search ( @Shape varchar ( 64 )= '' , @color Varchar ( 64 )= '' , @purity varchar ( 64 )= '' , @polish varchar ( 64 )= '' , @cut Varchar ( 64 )= '' , @pricemax varchar ( 50 )= '' , @pricemin varchar ( 50 )= '' , @caratMax varchar ( 50 )= '' , @caratmin varchar ( 50 )= '' , @symm varchar ( 64 )= '' , @fls varchar ( 64 )= '' , @userid varchar ( 64 )= '' , @PageNumber varchar ( 50 )= 0 , @PageSize Varchar ( 50 )= 0 ) As Begin   SET NOCOUNT ON ;   Declare @Search varchar ( max )= '' , @wherclause varchar ( max )= ''   if @PageNumber = '1'      begin           insert into gia_search_history ( user_id , shape_seq , color_seq , purity_Seq , Polish_s

Create Paging Query In the Sql Server

Here we create the Paging in SQL Server  Query here Fetch Only that Record which is Required Query: Select  S.*,SM.Name as shape,CM.Name as Color,PM.Name as Purity,POM.Name As Polish,CUM.Name as Cut,SYM.Name As Symm,Fm.Name as FLS from stock as S Inner join SHAPE_MAS As SM  on SM.SEQ_NO=S.shape_seq inner join COLOR_MAS As CM on CM.SEQ_NO=S.color_seq inner join PURITY_MAS As PM on PM.SEQ_NO=S.PURITY_SEQ inner join POLISH_MAS AS POM on POM.SEQ_NO=S.polish_seq inner join CUT_MAS As CUM on CUM.SEQ_NO=S.cut_seq inner join FLS_MAS As FM on FM.SEQ_NO=S.FLS_Seq inner join SYMM_MAS as SYM on SYM.SEQ_NO=S.SYMM_SEQ    order by S.SEQ_NO Asc OFFSET 25 * (2 - 1) ROWS   FETCH NEXT 25 ROWS ONLY Note:  Here  25 is Page Size You have set Default you Want and 2 is page no it is change every page which record  Example: OFFSET 50 * (3 - 1) ROWS   FETCH NEXT 50 ROWS ONLY Here we set Page Size 50 and page no is 3 This Is useful when we use  the html table use as Grid view and we have easily

Use Sql server With php

            To connect Ms SQL Server  In PhP Note: This is working in the Go-daddy  windows server No setting Required       if  use in the local they are some setting required in Php.ini and add  mssql.dll in  xamp or wamp server. Connect.Php <?php $server = Server Name/IP; $options = array( "UID" => "Username",  "PWD" => "Password",  "Database" => "DbName"); $conn = sqlsrv_connect($server, $options); ?> Note: Can't Close The Connection At Last.                   To Execute the Store Procedure In Php Web services Web_services.php <?php include("connect.php");     // Connection File Include Here     header('Content-Type:application/json;charset=utf8');   header('Access-Control-Allow-Origin: *');   header('Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS');   head