Home » Archive by categoryUncategorized

Visual Studio Code installation guide.

VS CODE Installlation Wizard
Go to Link https://code.visualstudio.com/docs?dv=win and it will start download VS Code for Windows. By running downloaded file (VSCodeSetup-stable.exe) Installation Wizard will open Chose location to install. Select start menu folder Select Additional Tasks   Ready to install Installing Completing and start VS Code And it’s start screen
Continue reading

Use Session Enabled Webservice in WindowsForm.

public class MyService : System.Web.Services.WebService { [WebMethod(EnableSession=true)] public void setMethod(bool value) { Session["myBoolVariable"] = value; } [WebMethod(EnableSession=true)] public bool getMethod() { return (bool)Session["myBoolVariable"]; } }   In above Webservice Session is used but in windows form application there is no any logic to use session so detect session...
Continue reading

Using Background worker in c#

private void InitTimer3() { tmrBack = new System.Windows.Forms.Timer(); tmrBack.Tick += new EventHandler(tmrBack_Tick); tmrBack.Interval = 1000; // in miliseconds tmrBack.Start(); } private void tmrBack_Tick(object sender, EventArgs e) { BackgroundWorker bw2 = new BackgroundWorker(); bw2.DoWork += new DoWorkEventHandler(bw2_DoWork); bw2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw2_RunWorkerCompleted); if (bw2.IsBusy != true) { bw2.RunWorkerAsync(); } }...
Continue reading

Checking website is online or offline in c#

public bool WebSiteIsAvailable(string Url) { string Message = string.Empty; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url); // Set the credentials to the current user account request.Credentials = System.Net.CredentialCache.DefaultCredentials; request.Method = "GET"; try { using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { return true;// Do nothing; we're only testing to see if we can...
Continue reading

MS SQL server Function to read response from Http

CREATE FUNCTION [dbo].[GetHttp] (@url VARCHAR(8000)) RETURNS VARCHAR(8000) AS BEGIN DECLARE @win INT DECLARE @hr INT DECLARE @text VARCHAR(8000) EXEC @hr = sp_OACreate 'WinHttp.WinHttpRequest.5.1' ,@win OUT IF @hr 0 EXEC sp_OAGetErrorInfo @win EXEC @hr = sp_OAMethod @win ,'Open' ,NULL ,'GET' ,@url ,'false' IF @hr 0 EXEC sp_OAGetErrorInfo @win EXEC...
Continue reading

Pagination in DatGridView C# from sql.

public void FillDataGridView1(string search,int page) { txtPage.Text = (page+1).ToString(); txtInfo.Text = (page+1).ToString() + " of " +((numberOfSubscriber()/1000)+1).ToString(); search = "%"+search+"%"; string query = @"SELECT Top 1000 * FROM Table where [TableID] like '" + search + "'and [ID] NOT IN (SELECT TOP "+page*1000+" id FROM [Table])"; try {...
Continue reading

C# – Read, Insert, Update, Delete From SQL Database

static void Read() { try { string connectionString = "server=.;" + "initial catalog=employee;" + "user id=sa;" + "password=sa123"; using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT * FROM EmployeeDetails", conn)) { SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { Console.WriteLine("Id...
Continue reading

StrorProcedure To Generate Data Provider Class From Table

************** Execute StoreProcedure **************** sp_CreateDataProviderFromTable 'Tablename', 'name' ************** StoreProcedure to store *************** CREATE proc [dbo].[sp_CreateDataProviderFromTable] ( @TableName NVARCHAR(50), @MethodName varchar(100) ) as DECLARE @ProtdVars VARCHAR(max),@PublicProps VARCHAR(max), @CMDProps VARCHAR(max), @InsertStmt VARCHAR(max), @UpdateStmt VARCHAR(max) DECLARE @PublicProps2 VARCHAR(max), @CMDProps2 VARCHAR(max),@CMDProps3 VARCHAR(max) , @PublicProps3 VARCHAR(max), @DRProps Varchar(max), @DRProps4 varchar(max), @DRProps2 varchar(max),@DRProps3 varchar(max)...
Continue reading

Subscribe

Join 901 other subscribers