tag:blogger.com,1999:blog-65936785397543141402024-02-19T08:13:32.583-08:00GET-YOUR-SOLUTIONASP.NET, SQL, CSS, JAVASCRIPT, WEB SERVICES,MOSS2007,SHAREPOINT SERVER,FAQs,Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.comBlogger65125tag:blogger.com,1999:blog-6593678539754314140.post-57393335575130607182016-12-11T22:04:00.000-08:002016-12-11T22:04:08.768-08:00A lightweight shopping cart web application in ASP.NET MVC 5http://bacaj.azurewebsites.net/a-lightweight-shopping-cart-web-application-in-asp-net-mvc-5/<br />
<br />
git code: https://github.com/lbacaj/OpenOrderFrameworkHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-10237444165741451062014-12-04T15:13:00.001-08:002014-12-04T15:13:04.585-08:00C# When to use if else and when to use ternary operator<br />
<br />
<b>If you have any control flow, then use if else</b><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int a = 1;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int b = 3;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Use negated expression.<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (!(a == 1 && b == 2))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
//Do some thing..<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Console.WriteLine(true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Use binary or version.<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (a != 1 || b != 2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{//Do some thing..<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Console.WriteLine(true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<br />
<b>If you have any condition, based on condition if you want to assign any value then use ternary operator</b><br />
<br />
Ex:<br />
int input = Convert.ToInt32(Console.ReadLine());<br />
string classify;<br />
classify = (input < 0) ? "negative" : "positive";Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-90823243688245427592014-12-04T07:13:00.001-08:002014-12-04T07:13:42.299-08:00Advantages of using ADO.NET<span style="background-color: white; font-family: Arial; font-size: 13px;">• All data in ADO.NET is transported in XML format</span><br style="background-color: white; font-family: Arial; font-size: 13px;" /><span style="background-color: white; font-family: Arial; font-size: 13px;">• ADO.NET can improve overall development time</span><br style="background-color: white; font-family: Arial; font-size: 13px;" /><span style="background-color: white; font-family: Arial; font-size: 13px;">• ADO.NET supports a variety of development needs</span><br style="background-color: white; font-family: Arial; font-size: 13px;" /><span style="background-color: white; font-family: Arial; font-size: 13px;">• ADO.NET can be used from all programming languages that target the .NET Framework</span>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-80028250893584454492014-12-02T11:18:00.002-08:002014-12-02T11:19:45.873-08:00Error in Web parts after SharePoint platform upgrade<br />
<br />
Using MOSS 2007 web part code, i have re build the VS 2010 SharePoint project. After deploying the webpart, i was getting error.<br />
<br />
<b><u>Solution</u></b>:<br />
I have added below tag in web.config<br />
<br />
SafeControl Assembly="MyCustomWebpart, Version=12.0.0.0, Culture=neutral, PublicKeyToken=bdb4a6220fe9433c” Namespace="MyProject.UI.WebParts” TypeName="ListItemReport" Safe="True" SafeAgainstScript="True"<br />
<safecontrol assembly="MyCustomWebpart, Version=12.0.0.0, Culture=neutral, PublicKeyToken=bdb4a6220fe9433c” Namespace=" myproject.ui.webparts="" safe="True" safeagainstscript="True" typename="ListItemReport"></safecontrol>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-1771297138895955592014-12-02T11:07:00.001-08:002014-12-02T11:07:21.859-08:00SharePoint remove and repair the broken Web Part<br />
<br />
Some times, you will see some webparts shows error, but will not able to delete that web parts.<br />
Using below url, you will able to delete the webparts.<br />
<br />
http://SPO/default.aspx?contents=1<br />
<br />
You will see all error-ed webparts, select webpart and delete.Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-58508564633993050342014-12-02T08:21:00.002-08:002014-12-02T08:21:42.794-08:00Error occurred in deployment step 'Activate Features': Cannot start service SPUserCodeV4 on computer <br />
<b><u>Root Cause</u></b>: Microsoft SharePoint Foundation Sandboxed Code Service is stopped.<br />
<b><u>Solution</u></b>:<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Open Central Administration site<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>go to System Settings<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>lick on Manage Service on server<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Check to see if Microsoft SharePoint Foundation Sandboxed Code Service is running, it should be stopped<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Start the service and try deploying the Sandboxed solutionHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-85394266976853748792014-12-01T23:32:00.004-08:002014-12-01T23:32:57.846-08:00Migrate MOSS 2007 Custom webpart to SharePoint 2010 <br />
First Get MOSS 2007 code.<br />
<br />
Open VS 2010<br />
Create new Empty SharePoint Project.<br />
Add New webpart.<br />
Now delete .cs from solution.<br />
Right click on Web part folder Add existing item.<br />
Select .cs file from old MOSS 2007 code folder.<br />
Save.<br />
Build.<br />
Resolve all references and errors.<br />
Deploy...<br />
<br />
<br />Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-59963140180068224672014-12-01T12:33:00.002-08:002014-12-01T12:33:23.020-08:00Unable to display this web part. To troubleshoot the problem, open this web page in a Microsoft SharePoint Foundation-Compatible HTML editor such as Microsoft SharePoint Designer<div dir="ltr" style="text-align: left;" trbidi="on">
<b><u>Error</u></b>: Unable to display this web part. To troubleshoot the problem, open this web page in a Microsoft SharePoint Foundation-Compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web Server Administrator. Correlation ID.<br />
<b><u>Solution</u></b><br />
This error occurs when the “AllowPersonalization” property of the Web Part Zone is set to false, and a user with less privilege tries to access the zone. This leads to the WebPartPageUsageException. This could be overcome by just setting the AllowPersonalization property to true.</div>
Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-55736043427403498222014-12-01T12:32:00.002-08:002014-12-01T12:32:59.908-08:00Error parameter name ncolindex<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
parameter name ncolindex<br />
This is a bug with SQL management studio and I need to use TSQL to attach the database<br />
USE [master]<br />
GO<br />
CREATE DATABASE [WSS_Content_Databasename] ON<br />
( FILENAME = N’E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename.mdf’ ),<br />
( FILENAME = N’E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename_log.LDF’ )<br />
FOR ATTACH<br />
GO<br />
if exists (select name from master.sys.databases sd where name = N’WSS_Content_databasename’ and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [WSS_Content_databasename].dbo.sp_changedbowner @loginame=N’sa’, @map=false<br />
GO<br />
<div>
<br /></div>
</div>
Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-60137309364850775162014-12-01T06:58:00.003-08:002014-12-01T06:58:55.267-08:00DATABASE Tuning<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>1) Return Multiple Resultsets </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>2) Connection Pooling and Object Pooling </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>3) Use SqlDataReader Instead of Dataset wherever it is possible </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>4) Keep Your Datasets Lean </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>5) Avoid Inefficient queries </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>6) Unnecessary round trips </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>7) Too many open connections </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>8) Avoid Transaction misuse </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>9) Avoid Over Normalized tables </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>10) Reduce Serialization </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>11) Do Not Use CommandBuilder at Run Time </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>12) Use Stored Procedures Whenever Possible </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>13) Avoid Auto-Generated Commands </strong></span></div>
<br />
<div>
<span style="color: #996633; font-family: arial; font-size: medium;"><strong>14) Use Sequential Access as Often as Possible </strong></span></div>
Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-30427917132857455282014-12-01T06:58:00.002-08:002014-12-01T06:58:20.792-08:00How to set, Person or Group field to Empty or Null in SharePoint using JSOM<br />
Today i was trying to set null value to Person or Group field.<br />
It was not straight way..<br />
<br />
<b><u>Solution:</u></b><br />
<br />
var objUser = new Array();<br />
Assign empty array to column of type "Person or Group"<br />
ojLstItem.set_item('MyPersonColumnName', objUser)Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-67116643852853600442014-11-24T11:25:00.001-08:002014-11-24T11:25:53.828-08:00Microsoft.Online.SharePoint.Client.Tenant.dll location<div dir="ltr" style="text-align: left;" trbidi="on">
I was trying to create Site Collection using client object model in SharePoint online.<br /> I came to know Microsoft.Online.SharePoint.Client.Tenant.dll is required to create Site Collection using client object model in SharePoint online.<br />
I was not able to find Microsoft.Online.SharePoint.Client.Tenant.dll<br />
<span style="text-decoration: underline;"><strong>Solution</strong></span>:<br /> <strong>Download</strong>: SharePoint Server 2013 Client Components SDK<br /> From below url.<br /> http://www.microsoft.com/en-au/download/details.aspx?id=35585<br />
Now go to below path, you will find Microsoft.Online.SharePoint.Client.Tenant.dll<br /> C:\Program Files\SharePoint Client Components\Assemblies\</div>
Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-43052047937168264942009-09-10T22:26:00.001-07:002009-09-10T22:26:43.267-07:00.Net-Insert Excel Data into Database// Connection String to Excel Workbook<br />string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Empinfo.xls;Extended Properties=""Excel 8.0;HDR=YES;""";<br />// Create Connection to Excel Workbook<br />using (OleDbConnection connection = new OleDbConnection(excelConnectionString))<br />{<br />OleDbCommand command = new OleDbCommand("Select * FROM [Sheet1$]", connection);<br />connection.Open();<br />// Create DbDataReader to Data Worksheet<br />using (OleDbDataReader dr = command.ExecuteReader())<br />{<br />// SQL Server Connection String<br />string sqlConnectionString = "Data Source=SCSHYD-067\\SQLEXPRESS;Initial Catalog=test;Integrated Security=True";<br />// Bulk Copy to SQL Server<br />using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))<br />{<br />bulkCopy.DestinationTableName = "INA_EIS_EMOF_EMEM_OFFL";<br />bulkCopy.WriteToServer(dr);<br />}<br />}<br />}Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-55628989786192170162009-09-10T21:41:00.000-07:002009-09-10T21:43:30.684-07:00SQl-Insert Excel Data into Database/****** Object: StoredProcedure [dbo].[fs_prog_rt_InsertTransaction] Script Date: 09/10/2009 19:47:29 ******/<br />SET ANSI_NULLS ON<br />GO<br />SET QUOTED_IDENTIFIER ON<br />GO<br />-- =============================================<br />-- Author: <author,,name><br />-- Create date: <create><br />-- Description: <description,,><br />-- =============================================<br />CREATE PROCEDURE [dbo].[fs_prog_rt_InsertTransaction]<br />@xmlData XML,<br />@ErrorMessage varchar(500) OUTPUT<br />AS<br />BEGIN<br />BEGIN TRY<br />SET NOCOUNT ON;<br /><br />DECLARE @SubId VARCHAR(20)<br />DECLARE @EntryType VARCHAR(50)<br />DECLARE @ContainerCode VARCHAR(20)<br />DECLARE @EquipmentId VARCHAR(20)<br />DECLARE @ProcessCode VARCHAR(20)<br />DECLARE @TestTypeCode VARCHAR(20)<br />DECLARE @CreatedByUserId VARCHAR(50)<br />DECLARE @CreatedTime VARCHAR(50)<br />DECLARE @idoc INT<br />DECLARE @LogId INT<br />DECLARE @return_Value INT<br />DECLARE @ValidationErrorMessage VARCHAR(500)<br /><br />EXEC sp_xml_preparedocument @idoc OUTPUT, @xmlData<br /><br />SELECT * into #temp_table FROM OPENXML (@idoc,'/NewDataSet/RT_Transaction',0)<br />WITH (LogId int 'LogId',<br />SubId varchar(50) 'SubId',<br />EntryType Varchar(50) 'EntryType',<br />ContainerCode varchar(50) 'ContainerCode',<br />CreatedByUserId varchar(10) 'CreatedByUserId',<br />ProcessCode varchar(100) 'ProcessCode',<br />EquipmentId varchar(50) 'EquipmentId',<br />TestTypeCode varchar(50) 'TestTypeCode',<br />CreatedTime varchar(100) 'CreatedTime')<br /><br />EXEC sp_xml_removedocument @idoc<br /><br />CREATE TABLE #temp_Errortable (<br />LogId int,<br />SubId varchar(50),EntryType Varchar(50),ContainerCode varchar(50),CreatedByUserId varchar(10),ProcessCode varchar(100),EquipmentId varchar(50),TestTypeCode varchar(50),CreatedTime varchar(100),ErrorMessage Varchar(250))<br /><br /><br /><br /><br />SELECT TOP 1 @LogId = [LOGID] FROM #temp_table<br /><br />WHILE (ISNULL(@LogId,0) <> 0)<br />BEGIN<br />SELECT<br />@SubId = SubID,<br />@EntryType = EntryType,<br />@ContainerCode = ContainerCode,<br />@EquipmentId = EquipmentId,<br />@ProcessCode = ProcessCode,<br />@TestTypeCode = TestTypeCode,<br />@CreatedByUserId = CreatedByUserId,<br />@CreatedTime = CreatedTime<br />FROM #temp_table WHERE [LOGID] = @LogId<br /><br />IF (@EntryType = 'Cart/Box')<br />BEGIN<br />EXEC @return_Value = dbo.RT_ValidateAndInsertCart @SubId,@EntryType,@ContainerCode,@CreatedByUserId,@ValidationErrorMessage OUTPUT,@ErrorMessage OUTPUT<br />END<br />ELSE<br />BEGIN<br />EXEC @return_Value = dbo.RT_ValidateAndInsertEquipment @SubId,@EntryType,@EquipmentId,@TestTypeCode,@ProcessCode,@CreatedByUserId,@ValidationErrorMessage OUTPUT,@ErrorMessage OUTPUT<br />END<br />IF (@ValidationErrorMessage <> '')<br />BEGIN<br />-- INSERT INTO #temp_Errortable SELECT LogId,SubId,EntryType,ContainerCode,CreatedByUserId,ProcessCode,EquipmentId,TestTypeCode,CreatedTime,@ValidationErrorMessage AS ErrorMessage FROM #temp_table Where LogId=@LogId<br />INSERT INTO #temp_Errortable Values(@LogId,@SubId,@EntryType,@ContainerCode,@CreatedByUserId,@ProcessCode,@EquipmentId,@TestTypeCode,@CreatedTime,@ValidationErrorMessage)<br />END<br /><br />DELETE #temp_table WHERE [LOGID] = @LogId<br />set @LogId = 0<br />SELECT TOP 1 @LogId=[LOGID] FROM #temp_table<br />END<br /><br />DROP TABLE #temp_table<br /><br />Select * From #temp_Errortable<br />DROP TABLE #temp_Errortable<br />SET NOCOUNT OFF<br />END TRY<br />BEGIN CATCH<br />BEGIN<br />SELECT @ErrorMessage=ERROR_MESSAGE()<br />END<br />END CATCH<br />ENDHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-47303551923490561642009-09-07T04:29:00.000-07:002009-09-07T04:30:17.644-07:00String Array<span style="color:#cc33cc;">strEmployeeName="Tester(Test)";<br />/// <summary><br />/// It will return Full name and FQN<br />/// </summary><br />/// <param name="strEmployeeName"></param><br />/// <returns></returns><br />public string[] SplitEmployeeNameFQN(string strEmployeeName)<br />{<br />string[] strInputValue = strEmployeeName.Split(';');<br />string[] arrReturn = new string[2];<br />//string employeeName = string.Empty;<br />string strFQN = string.Empty;<br />for (int i = 0; i < strInputValue.Length; i++)<br />{<br />if (!(strInputValue[i] == ""))<br />{<br />int startIndex = strInputValue[i].IndexOf("(");<br />strFQN = strInputValue[i].Substring(startIndex + 1);<br />strFQN = strFQN.Replace(")", "");<br />arrReturn[0] += strFQN.Trim() + ";";<br />arrReturn[1] += strInputValue[i].Remove(startIndex).Trim() + ";";<br />}<br />}<br /><br />return arrReturn;<br />} </span>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-75762217654648205502009-08-24T22:31:00.001-07:002009-08-24T22:31:38.919-07:00SQL SearchCREATE PROCEDURE [dbo].[GetSparePartsECRETS] <br />( <br /> @pnEcretsNum INT = NULL <br /> ,@pnvcEcretsTitle NVARCHAR(100) = NULL <br /> ,@pnvcOriginatorID NVARCHAR(50) = NULL <br />) <br />AS <br /> <br />BEGIN <br /> <br /> /*SET NOCOUNT TO ON AND NO LONGER DISPLAY THE COUNT MESSAGE*/ <br /> SET NOCOUNT ON <br /> <br /> /*START THE TRY BLOCK*/ <br /> BEGIN TRY <br /> IF @pnEcretsNum = '' SET @pnEcretsNum = NULL <br /> IF @pnvcEcretsTitle = '' SET @pnvcEcretsTitle = NULL <br /> IF @pnvcOriginatorID = '' SET @pnvcOriginatorID = NULL <br /> <br /> SELECT <br /> TBLE.ECRETSID, <br /> TBLE.[Title], <br /> [TBEI].[FirstName] +' '+COALESCE([TBEI].[LastName],'') AS Originator <br /> FROM dbo.tblECRETS TBLE, <br /> dbo.TblEmployeeInfo TBEI <br /> WHERE (TBLE.ECRETSID = @pnEcretsNum OR @pnEcretsNum IS NULL) <br /> AND (TBLE.Title = @pnvcEcretsTitle OR @pnvcEcretsTitle IS NULL) <br /> AND (TBLE.OriginatorID = @pnvcOriginatorID OR @pnvcOriginatorID IS NULL) <br /> AND TBLE.OriginatorID = TBEI.FQN <br /> <br /> END TRY <br /> BEGIN CATCH <br /> IF @@ERROR != 0 <br /> BEGIN <br /> SELECT <br /> ERROR_NUMBER() AS ErrorNumber <br /> ,ERROR_MESSAGE() AS ErrorMessage <br /> END <br /> END CATCH <br /> <br /> /*Reset SET NOCOUNT to OFF*/ <br /> SET NOCOUNT OFF <br />ENDHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-58609925853975782092009-07-23T00:50:00.001-07:002009-07-23T00:50:44.119-07:00Web Services1. Which attribute is used in order that the method can be used as WebService ? <br /> WebMethod attribute has to be specified in order that the method and property can be treated as WebService.<br />2. Do webservice have state ? <br />Twist :- How can we maintain State in Webservices ?<br /> Webservices as such do not have any mechanism by which they can maintain state.<br />3. How to Authentication for Web Services<br /> using SOAP headers<br />4. HOW TO: Pass Current Credentials to an ASP.NET Web Service<br /> myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials<br />OR<br /> localhost.MyWebService myService = new localhost.MyWebService();<br /> System.Net.CredentialCache myCredentials = new System.Net.CredentialCache();<br /> NetworkCredential netCred = new NetworkCredential("UserName", "Password");<br /> myCredentials.Add(new Uri(myService.Url), "Basic", netCred);<br /> myService.Credentials = myCredentials;<br />---------<br /> DataSet dsPartDetails = new DataSet();<br /> Item[] arrPartDetails = null;<br /> arrPartDetails = objSrchPartsCommonMethods.GetPartService(vendorPartNum, manPartNum);<br /> dsPartDetails = objSrchPartsCommonMethods.ConvertArrayToDataSet(arrPartDetails);<br />----------------------------------<br /><br /><br /> public FirstSolarMasterDataServices.Item[] GetPartService(string partNumber, string manPartNum)<br /> {<br /> try<br /> {<br /> FirstSolarMasterDataServices.MasterData objFirstSolarERPWebService = new FirstSolarMasterDataServices.MasterData();<br /> FirstSolarMasterDataServices.Item[] arrParts;<br /><br /> objFirstSolarERPWebService = ImpersonateDevUser();<br /><br /> //Calling Web services menthods<br /> arrParts = objFirstSolarERPWebService.GetItems(ConfigurationManager.AppSettings["CompanyId"].ToString(), "", partNumber, "","",manPartNum);<br /> return arrParts;<br /> }<br /> catch<br /> {<br /> throw;<br /> }<br /> //code used at Onsite<br /> //comment this code at ODC<br /><br /> //finally<br /> //{<br /> // if (m_Ctx != null)<br /> // {<br /> // m_Ctx.Undo();<br /> // }<br /> //}<br /> }<br /><br /> private FirstSolarMasterDataServices.MasterData ImpersonateDevUser()<br /> {<br /> FirstSolarMasterDataServices.MasterData objFirstSolarErpModifyWebService = new FirstSolarMasterDataServices.MasterData();<br /><br /> try<br /> {<br /> //code used at ODC<br /> //comment this code at Onsite<br /> //*************************************<br /> <br /> NetworkCredential nwCredentials = new NetworkCredential();<br /><br /> nwCredentials.UserName = ConfigurationManager.AppSettings["NWUserName"].ToString();<br /> nwCredentials.Password = ConfigurationManager.AppSettings["NWPassword"].ToString();<br /> nwCredentials.Domain = ConfigurationManager.AppSettings["NWDomain"].ToString();<br /><br /> //Assignign credentials to web services<br /> objFirstSolarErpModifyWebService.Credentials = new NetworkCredential(nwCredentials.UserName, nwCredentials.Password, nwCredentials.Domain);<br /><br /> //*************************************<br /><br /><br /> //code used at Onsite<br /> //comment this code at ODC<br /> //*************************************<br /><br /> //m_Ctx = WindowsIdentity.GetCurrent().Impersonate();<br /> //RevertToSelf();<br /><br /> //objFirstSolarERPModifyWebService.Url = ModifyWebService;<br /><br /> // //We have to authenticate ourselves with the web service.<br /> //objFirstSolarERPModifyWebService.PreAuthenticate = true;<br /> //objFirstSolarERPModifyWebService.Credentials = System.Net.CredentialCache.DefaultCredentials; <br /><br /> //*************************************<br /> }<br /> catch<br /> {<br /> throw;<br /> }<br /><br /> return objFirstSolarErpModifyWebService;<br /> }<br />------------------<br />Covert Arrat to Dataset<br />---<br /> public DataSet ConvertArrayToDataSet(Object[] objArray)<br /> {<br /> XmlTextReader reader;<br /> DataSet arrayDataSet = new DataSet();<br /> MemoryStream memStream = new MemoryStream();<br /> XmlTextWriter writer = new XmlTextWriter(memStream, System.Text.Encoding.UTF8);<br /> XmlSerializer serializer = new XmlSerializer(objArray.GetType());<br /> try<br /> {<br /> serializer.Serialize(writer, objArray);<br /> memStream.Position = 0;<br /> reader = new XmlTextReader(memStream);<br /> arrayDataSet.ReadXml(reader);<br /><br /> return arrayDataSet;<br /> }<br /> catch (Exception ex)<br /> {<br /> throw;<br /> }<br /> }Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-68828740131793850862009-07-21T05:18:00.001-07:002009-07-21T05:18:52.643-07:00Use Data Viewprotected void BindEmployee()<br /> {<br /> ConnectDB objConnectDB = null;<br /> SqlConnection objSqlConnection = null;<br /> SqlCommand objSqlCommand = null;<br /> SqlDataAdapter objSqlDataAdapter = null;<br /> DataSet objDataSet = null;<br /> try<br /> {<br /> objConnectDB = new ConnectDB();<br /> objSqlConnection = objConnectDB.getConnection();<br /> objDataSet = new DataSet();<br /> //string strSQL = "SELECT GUID,FirstName+' '+coalesce(LastName,'') as FullName from TblEmployeeInfo where active=1 order by FirstName+' '+coalesce(LastName,'')";<br /> string strSQL = "SELECT GUID, FirstName+' '+coalesce(LastName,'') as FullName, REPLACE(FirstName+' '+coalesce(LastName,''),'''','\\''') as FullNameRead from TblEmployeeInfo where active=1 order by FirstName+' '+coalesce(LastName,'')";<br /><br /> objSqlCommand = new SqlCommand(strSQL, objSqlConnection);<br /> objSqlDataAdapter = new SqlDataAdapter(objSqlCommand);<br /><br /> objSqlDataAdapter.Fill(objDataSet);<br /><br /> if (txtFilter.Text == "")<br /> {<br /> grdvwEmployee.DataSource = objDataSet.Tables[0];<br /> }<br /> else<br /> {<br /> //DataView dv = new DataView(objDataSet.Tables[0], "FullName like '%" + txtFilter.Text.Trim() + "%'", "", DataViewRowState.CurrentRows);<br /> DataView dv = new DataView(objDataSet.Tables[0], "FullName like '%" + txtFilter.Text.Trim().Replace("'", "") + "%'", "", DataViewRowState.CurrentRows);<br /> grdvwEmployee.DataSource = dv;<br /> }<br /><br /> <br /> grdvwEmployee.DataBind();<br /><br /> <br /> }<br /> catch (Exception ex)<br /> {<br /> lblMsg.Text = "Error: " + ex.Message;<br /> }<br /> finally<br /> {<br /> objSqlCommand.Dispose();<br /> objSqlDataAdapter.Dispose();<br /> objDataSet.Dispose();<br /> }<br /> }Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-62958621126783598702009-07-20T03:12:00.000-07:002009-07-20T03:13:47.139-07:00Get Selected result with Comma separateCREATE TABLE dbo.tblItems<br />(<br />ItemID int NOT NULL IDENTITY (1, 1),<br />ItemName nvarchar(50) NOT NULL<br />) ON [PRIMARY]<br />GO<br />ALTER TABLE dbo.tblItems ADD CONSTRAINT<br />PK_Table_1 PRIMARY KEY CLUSTERED<br />( ItemID )<br />GO<br /><br /><br /><br />Insert into dbo.tblItems (ItemName) Values ('Item1')<br />Insert into dbo.tblItems (ItemName) Values ('Item2')<br />Insert into dbo.tblItems (ItemName) Values ('Item3')<br />Insert into dbo.tblItems (ItemName) Values ('Item4')<br />Go<br /><br /><br />Declare @m_ItemsList nvarchar(2000)<br />Select @m_ItemsList=''<br />Select @m_ItemsList=@m_ItemsList+ItemName+',' from tblItems<br />Select Left(@m_ItemsList,Len(@m_ItemsList)-1)Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-3528450064842295472009-07-14T22:51:00.000-07:002009-07-14T22:52:37.456-07:00Gridview- Text Box Changed<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnBNl-cvYR5prwIKGHo-efnOzEExGsz1n7rf4XB4mJn1COfhCWGsx4HBFrKSEqNnWxH9uDx383KVOPH6R8VrT4obukhDZ6fb6BQOd7qzb-7Orf_rxy1mIoGQ_u7so2OFaFo35aqfcO1zMa/s1600-h/Grid_TextBox.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 162px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnBNl-cvYR5prwIKGHo-efnOzEExGsz1n7rf4XB4mJn1COfhCWGsx4HBFrKSEqNnWxH9uDx383KVOPH6R8VrT4obukhDZ6fb6BQOd7qzb-7Orf_rxy1mIoGQ_u7so2OFaFo35aqfcO1zMa/s320/Grid_TextBox.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5358560744356688434" /></a>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-79506902056072905912009-07-13T07:39:00.000-07:002009-07-13T07:44:29.736-07:00Javascript with DIV for tool tip<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIB8vzX9vwB47_UjAiJVfISomV3fOoWvRRYsXIf5aWbay8yOSHhMYyEqJm5KCyC7iB8oTp1tzA0aUqE0R8oYLpAIIcTIumNjXBqUIRg7L488fnnqqB_tEn2F65Yf9lwU7yl2LkKhnt3iR7/s1600-h/JS-DIV.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 207px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIB8vzX9vwB47_UjAiJVfISomV3fOoWvRRYsXIf5aWbay8yOSHhMYyEqJm5KCyC7iB8oTp1tzA0aUqE0R8oYLpAIIcTIumNjXBqUIRg7L488fnnqqB_tEn2F65Yf9lwU7yl2LkKhnt3iR7/s320/JS-DIV.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5357955650014417362" /></a>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-76229772619244964072009-07-13T07:33:00.001-07:002009-07-13T07:33:38.360-07:00Javascript with DIV for tool tip<style><br /> .tip <br />{<br /> text-align:left;<br /> font:11px Arial; <br /> color:Black;<br /> border: Solid 1px Black; <br /> width:292px; <br /> padding:1px;<br /> position:absolute; <br /> background-color:#FFFFE1;<br /> <br />}<br /> </style><br /><table><br /> <tr><br /> <td><br /> <span onmouseout="dvLedgerTooltip.style.visibility='hidden'" onmouseover="dvLedgerTooltip.style.visibility='visible'"<br /> style="cursor: hand; ime-mode: active; color: Red">[?]</span><br /> <div id="dvLedgerTooltip" style="visibility: hidden; width: 400px; position: absolute;<br /> height: 40px; z-index: 100;"><br /> <asp:Label ID="lblLedger" runat="server" CssClass="tip">When the Purchase Requisition type is Expense, please select the applicable ledger code from the drop down list. When the Purchase Requisition type is Capital or Both, please select ledger code 13105 – Construction In Progress from the drop down list.</asp:Label><br /> </div><br /> </td><br /> </tr><br /> <br /> <tr><br /> <td class="label" colspan="2"><br /> <span class="astrict">*</span>Part Type:</td><br /> <td class="label"><br /> <span style="color: #ff0000">*<span style="color: #000000">Preventative Maintenance<br /> Part</span></span>:<br /> <asp:Image ID="Image3" runat="server" ImageUrl="~/Images/Question.jpg" onmouseout="Div3.style.visibility='hidden'"<br /> onmouseover="Div3.style.visibility='visible'" /><br /> <div id="Div3" style="visibility: hidden; width: 400px; position: absolute; height: 40px;<br /> z-index: 100;"><br /> <asp:Label ID="Label3" runat="server" CssClass="tip">Indicates if the part is a preventative maintenance part that requires replacement on a regular basis (two or more times per year).</asp:Label><br /> </div><br /> </td><br /> </tr><br /> </table>Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-61305923613781716162009-07-12T22:55:00.000-07:002009-07-23T01:22:38.831-07:00Dot Net FAQsExecuteNonQuery-returns number of rows effected<br />ExecuteReader-It will return SQLDatareader(Set of records)<br />ExecuteScalar-It will return last inserted row value.<br /><br />GAC- C:\WINDOWS\assembly<br />ILDASM.EXE- C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin<br />Q)IS there any way to restrict the Developer to delete a assembly? How can i do? pros and cons?<br />Ans.Yes,By placing the assembly in to GAC.<br /><br />System.GC.AddMemoryPressure(200024);<br />System.GC.RemoveMemoryPressure(200024);<br />This statements will be usefull while uploading large files from .Net to server <br />System.GC.Collect()- forces garbage collector to run<br /><br />1) What are situations when you register .NET assembly in GAC ?<br /><br />2) What’s the difference between Cache object and application object ?<br /><br />The main difference between the Cache and Application objects is that the Cache object<br />provides cache-specific features, such as dependencies and expiration policies.<br /><br />3) When we use Cache object and when we use application object?<br /><br />4) How can get access to cache object ?<br /><br />You can get a reference<br />to the Cache object by using the Cache property of the HttpContext class <br /><br />5) Where do you specify session state mode in ASP.NET ?<br /><br />6)What are benefits and limitations of using Cookies?<br /><br />7)How u define the cookie in ASP.Net?<br />Request.Cookies.Add(New HttpCookie(“name”, “user1”))<br /><br />8)How cross page posting can be achieved in ASP.Net?<br /><asp:Button ID="Button1" runat="server"<br />PostBackUrl="~/nextpage.aspx" Text="Post to nextpage" /><br /><br />9)How delegates used for event handling?<br /><br />10)Can you prevent a class from overriding ?<br /><br />11)What is the significance of Finalize method in .NET?<br /><br />12)When we required System.StringBuilder classes?<br /><br />13)How can we skip some set of code from the Page PostBack?<br /><br />14)Where is ViewState information stored ?<br />In HTML Hidden Fields.<br /><br /><br />15)How can you enable automatic paging in DataGrid ?<br /><br /><br />16)What is the method to customize columns in DataGrid?<br />Use the template column.<br /><br />17)What are major events in GLOBAL.ASAX file ?What order they are triggered ?<br /><br />18)where do we enable tracing ?<br /><%@ Page Trace="true" %><br /><br /><br />19) How to kill a session in asp.net?<br /><br />Session.abandon<br /><br />20) How can I track event in checkbox which is one of the columns of a datagrid ?<br /><br />21) What is difference between Constant and readonly properties?<br /><br /> get accessor in property implemantation.<br /> <br />22) Is structure can be inherited?<br /><br />23) what is difference between static variable and private variable?<br /><br />24) What is use of virtual method in a base class?<br /><br />25) When we require interface? when we require abstract?<br /><br />26) what is use of out parameter in c#?<br /><br />27) what is the scope of extern variable?<br /><br />28) what is use of static constructor?<br /><br />29) What is the difference between is and as?<br />The AS operator is used to perform certain type of conversion between compatible reference types.<br />IS checks if object is compatiable with a given type.<br /><br />30) What is scope of access modifers like internal,protected?<br /><br />31) what is the use of partial classes?<br /><br />32) What is the use of “OverRides” and “Overridable” keywords ?<br />Overridable is used in parent class to indicate that a method can be overridden. Overrides<br />is used in the child class to indicate that you are overriding a method<br /><br /><br />33)In what instances you will declare a constructor to be private?<br />When we create a private constructor, we can not create object of the class directly from<br />a client. So you will use private constructors when you do not want instances of the class<br />to be created by any external client. Example UTILITY functions in project will have no<br />instance and be used with out creating instance, as creating instances of the class would<br />be waste of memory.<br /><br />34)Can two catch blocks be executed?<br />No, once the proper catch section is executed the control goes finally to block. So there<br />will not be any scenarios in which multiple catch blocks will be executed.<br /><br />35)What is impersonation in ASP.NET ?<br />By default, ASP.NET executes in the security context of a restricted user account on the<br />local machine. Sometimes you need to access network resources such as a file on a shared<br />drive, which requires additional permissions. One way to overcome this restriction is to<br />use impersonation. With impersonation, ASP.NET can execute the request using the<br />identity of the client who is making the request, or ASP.NET can impersonate a specific<br />account you specify in web.config.<br /><br /><br />36)Can you explain in brief how the ASP.NET authentication process works?<br />ASP.NET does not run by itself, it runs inside the process of IIS. So there are two<br />authentication layers which exist in ASP.NET system. First authentication happens at<br />the IIS level and then at the ASP.NET level depending on the WEB.CONFIG file.<br />Below is how the whole process works:-<br />v IIS first checks to make sure the incoming request comes from an IP address<br />that is allowed access to the domain. If not it denies the request.<br />v Next IIS performs its own user authentication if it is configured to do so. By<br />default IIS allows anonymous access, so requests are automatically<br />authenticated, but you can change this default on a per – application basis<br />with in IIS.<br />v If the request is passed to ASP.net with an authenticated user, ASP.net checks<br />to see whether impersonation is enabled. If impersonation is enabled, ASP.net<br />acts as though it were the authenticated user. If not ASP.net acts with its own<br />configured account.<br />v Finally the identity from step 3 is used to request resources from the operating<br />system. If ASP.net authentication can obtain all the necessary resources it<br />grants the users request otherwise it is denied. Resources can include much<br />more than just the ASP.net page itself you can also use .Net’s code access<br />security features to extend this authorization step to disk files, Registry keys<br />and other resources.<br /><br />37)How can we check if all the validation control are valid<br />and proper ?<br />Using the Page.IsValid() property you can check whether all the validation are done<br /><br /><br />38)What are the two fundamental objects in ADO.NET ?<br />Datareader and Dataset are the two fundamental objects in ADO.NET.<br /><br />39)What is the use of command objects ?<br />They are used to connect connection object to Datareader or dataset. Following are the<br />methods provided by command object :-<br />v ExecuteNonQuery :- Executes the command defined in the CommandText<br />property against the connection defined in the Connection property for a query<br />that does not return any row (an UPDATE, DELETE or INSERT). Returns<br />an Integer indicating the number of rows affected by the query.<br />v ExecuteReader :- Executes the command defined in the CommandText property<br />against the connection defined in the Connection property. Returns a "reader"<br />object that is connected to the resulting rowset within the database, allowing<br />the rows to be retrieved.<br />v ExecuteScalar :- Executes the command defined in the CommandText property<br />against the connection defined in the Connection property. Returns only<br />single value (effectively the first column of the first row of the resulting rowset)<br />any other returned columns and rows are discarded. It is fast and efficient<br />when only a "singleton" value is required<br /><br /><br />What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?<br />You can use Having Clause with the GROUP BY function in a query and WHERE<br />Clause is applied to each row before they are part of the GROUP BY function in a query.<br /><br />(B) What is the difference between UNION and UNION ALL SQL syntax ?<br />UNION SQL syntax is used to select information from two tables. But it selects only<br />distinct records from both the table, while UNION ALL selects all records from both the<br />tables.<br /><br /><br /><br />When listing product information you might want to draw the user's eye to products that <br />are out of stock. one way to accomplish this would be to change the back ground colour of those<br />rows with unit in stock value of 0.<br /><br />The gridview offers a onRowDataBound event that fires once for each row after the row has been creted <br />and bound to corresponding record of data from the data source control.Hihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-57517273513352687492009-07-12T22:54:00.000-07:002009-07-12T22:55:02.836-07:00FAQ1.architecture of .net<br />2.What is IL and CLR<br />3.Collections -Arrary, array list , hash array<br />4.How can we handile exception in .Net and SQL server--<br />5.Tell me simple steps to bind a grid using sql connection<br />6.State management-<br />7.Diff b/w Session and application memory<br />8.How to swap 2 values with out using temp<br />9.Overriding and Overloading<br />10. Dataset and reader...<br />11. Can we run all versions of .Net applications in same server.<br />12.One array size is 100, i have entered 99 records(Numbers from 1 to 100) in that array, how can i find missed value.<br />13.I have 2 arrays with diff size, i want to dispaly matched records and unmatched recores.<br />14..Net is plat form independent.<br />15. Tell me what are the namespaces we use to work with ajax. (Ans: System.Web.Extensions, System.Web.Extensions.Design)<br />16. Can my application can have more that 1 .config files...YES<br />17.Can i have more that one DLL with same name in my system. Ans)Yes in GAC it is possible<br />18.Diff b/w EXE and DLL<br />19.How can we improve asp.net application erformance.<br />22. architecture of u r current application. how can u support u r architecture is sutable for u r aplication.<br />23.how can we call webservices.<br /><br />Tell u have a knowledge on workflows.....which u have..<br />1.what is workflow.<br />2.what is the use of workflows<br /><br />Diff b/w function and SP in SQL<br />New features in sql 2005 that 2000<br />what is index in sql and advantages, diss adva?<br /><br /><br />How to get inserted row identity value from Database in SP?<br />Ans)<br />If you are using SQL Server 7.0, simply change the line in the stored procedure from ... <br /> <br />SELECT NEWID = SCOPE_IDENTITY() <br /> <br />... to ... <br /> <br />SELECT NEWID = @@IDENTITYHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0tag:blogger.com,1999:blog-6593678539754314140.post-43775818461686996892009-05-28T07:07:00.000-07:002009-05-28T07:19:30.047-07:00SQLALTER TABLE Table_1 ALTER COLUMN test1 nchar(20)<br />------------------------------<br />Declare @NewInt<br /> intexec DebugA 5,@NewInt OUTPUT<br />Select @NewInt<br />-------------------<br />CREATE TABLE tt (EntryID uniqueidentifier DEFAULT NewID())<br />select EntryID from ttt<br />CREATE TABLE ttt (EntryID uniqueidentifier DEFAULT NewSequentialID())<br />INSERT INTO tt DEFAULT VALUES<br />-------------------------------------------------<br />--Table structure<br /><br />CREATE TABLE dbo.GUIDTable2<br />(<br />GUIDCol uniqueidentifier NOT NULL PRIMARY KEY DEFAULT (NEWID()),<br />OtherColumn varchar(25) NOT NULL<br />)<br />GO<br />INSERT INTO dbo.GUIDTable2 (OtherColumn) VALUES ('Performance tuning')<br />select * from GUIDTable2<br />------------------------------------------------<br />Auto Increment<br />-----------------<br />Create TABLE tbl_Processes<br />(<br />ProcessID int IDENTITY(1,1),<br />ProcessName nvarchar (100),<br />Active bit,<br />CONSTRAINT pk_PersonID PRIMARY KEY (ProcessID)<br />)<br />-----------------------------------------------------<br /><br />Create TABLE new_employees<br />(<br />id_num int IDENTITY(1,1),<br />fname varchar (20)<br />)<br />--------------------------------<br />CREATE TABLE Persons<br />(<br />P_Id int NOT NULL PRIMARY KEY,<br />LastName varchar(255) NOT NULL,<br />FirstName varchar(255),<br />Address varchar(255),<br />City varchar(255)<br />)<br />----------------------------<br />CREATE TABLE Persons<br />(<br />P_Id int NOT NULL,<br />LastName varchar(255) NOT NULL,<br />FirstName varchar(255),<br />Address varchar(255),<br />City varchar(255),<br />CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastName)<br />)<br />----------------------------------------------<br />CREATE TABLE Customer<br />(SID integer PRIMARY KEY,<br />Last_Name varchar(30),<br />First_Name varchar(30));<br /><br />-----------------------------------<br />CREATE TABLE ORDERS<br />(Order_ID integer primary key,<br />Order_Date datetime,<br />Customer_SID integer references CUSTOMER(SID),<br />Amount double);<br /><br />--------------------------------------------------------<br /><br />SELECT *<br />FROM TableName E1<br />WHERE (N =<br />(SELECT COUNT(DISTINCT (E2.sal))<br />FROM TableName E2<br />WHERE E2.sal >= E1.sal))<br /><br /><br />-------------------------------------------------------------------------<br /><br />sp_helptext GetUniqueAppID-------We can view the sp<br />---------------------------------<br />SQL Server Installation<br />-----------------------<br />http://www.functionx.com/sqlserver/Lesson01.htm<br />http://www.exforsys.com/tutorials/sql-server-2005/getting-started-with-sql-server-2005/1.html<br /><br /><br /><br />http://www.ss64.com/sql/<br /><br />Copying a Database from SQL Server 2005 to SQL Server 2008 using the Copy Database Wizard<br /><br />http://www.packtpub.com/article/copying-database-sql-2008-copy-database-wizard<br /><br />http://blog.sqlauthority.com/<br /><br />Reporting Services:<br />--------------------<br />http://msdn.microsoft.com/en-us/magazine/cc188691.aspx<br /><br />http://www.microsoft.com/technet/prodtechnol/sql/2005/2005ssrs.mspx<br /><br />http://www.simple-talk.com/sql/learn-sql-server/beginning-sql-server-2005-reporting-services-part-1/<br /><br />http://www.dotnetheaven.com/UploadFile/ursbgiri/106012007065515AM/1.aspx<br /><br />Reporting<br />------------<br />http://www.codeproject.com/KB/database/MergeReplication.aspx<br />http://www.codeproject.com/KB/reporting-services/RecursiveData.aspx<br /><br /><br /><br />GOOD:<br />=====<br />SELECT max( mark ) FROM `student`<br />--------------------<br />SELECT * FROM Product where Product_price = (<br />SELECT MAX(Product_price)FROM Product WHERE Product_price < (SELECT MAX(Product_price) FROM Product) ) -------------------- SELECT * FROM Product E1 WHERE(3 =(SELECT COUNT(DISTINCT (E2.Product_price))FROM Product E2 WHERE E2.Product_price >= E1.Product_price))<br />----------------------------------------------------------------------------------------------------<br /><br />Renaming a Column<br />------------------<br />sp_rename 'TableName.ColumnName', 'NewColumnName', 'COLUMN'<br /><br />Deleting a Column<br />-----------------<br />ALTER TABLE TableName<br />DROP COLUMN ColumnName<br /><br />DATE TIME<br />---------<br />http://www.sqljunkies.ddj.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk<br /><br />Retrieve Current Date Time in SQL Server<br />----------------------------------------<br />SELECT {fn NOW()}<br />GO<br />SELECT GETDATE()<br />GO<br />SELECT CURRENT_TIMESTAMP<br />GO<br /><br /><br />SELECT CONVERT(VARCHAR(10),GETDATE(),111)<br />--------------------------------<br />DateTime dtDOB = Convert.ToDateTime(Request.Form["TextBox1"].ToString());<br />DateTime dtNow = DateTime.Now;<br />//TimeSpan k=dtNow.Subtract(dtDOB);<br /><br />if ((dtNow.Subtract(dtDOB).TotalDays / 365) < 18)<br />{<br />Response.Write("Sorry");<br />}<br />else<br />{<br />Response.Write("Success");<br />}<br />-------------------------------------------------<br />CREATE TABLE MyTable<br />(<br />ID TINYINT NOT NULL IDENTITY (1, 1),<br />FirstCol TINYINT NOT NULL,<br />SecondCol TINYINT NOT NULL,<br />ThirdCol TINYINT NOT NULL,<br />ComputedCol AS (FirstCol+SecondCol)*ThirdCol<br />) ON [PRIMARY]<br />GO<br /><br />INSERT INTO MyTable<br />([FirstCol],[SecondCol] ,[ThirdCol]) values (1,2,3)<br />GO<br /><br />SELECT *<br />FROM MyTable<br />GO<br />----------------------------------------------------\\<br /><br />http://publib.boulder.ibm.com/infocenter/rbhelp/v6r3/index.jsp?topic=/com.ibm.redbrick.doc6.3/sqlrg/sqlrg67.htm<br />-----------------------------------------------------------------------------------------<br />CREATE PROCEDURE [dbo].[VALIDATEUSER]<br />@UserName VARCHAR(100),<br />@Password VARCHAR(100),<br />@Result INT OUT<br />AS<br />BEGIN<br />DECLARE @Cnt AS INT<br /><br />SELECT @Cnt = COUNT(*) FROM USERS WHERE USERNAME=@UserName AND PASSWORD=@Password<br />IF(@Cnt=0)<br />BEGIN<br /><br />SELECT @Cnt = COUNT(*) FROM USERS WHERE USERNAME=@UserName<br />IF(@Cnt=0)<br />BEGIN<br />SET @Result = -1<br />END<br />ELSE<br />BEGIN<br />SET @Result = 0<br />END<br /><br />END<br />ELSE<br />BEGIN<br />SELECT @Result=USERID FROM USERS WHERE USERNAME=@UserName AND PASSWORD=@Password<br />END<br />ENDHihttp://www.blogger.com/profile/11792862754668750943noreply@blogger.com0