Posts

Count String using C#

Count space int countSpaces = mystring . Count ( Char . IsWhiteSpace ); Count Character in a string static int CountChars (string value) { int result = 0; bool lastWasSpace = false; foreach (char c in value) { if (char.IsWhiteSpace(c)) { // A. // Only count sequential spaces one time. if (lastWasSpace == false) { result++; } lastWasSpace = true; } else { // B. // Count other characters every time. result++; lastWasSpace = false; } } return result; }     counts non-whitespace characters.   static int CountNonSpaceChars (string value) { int result = 0; foreach (char c in value) { if (!char.IsWhiteSpace(c)) { result++; } } return result; }    

UPDATE TRIGGER ON TABLE

Trigger are three types : INSERT, UPDATE, DELETE and trigger have two magic table  INSERTED and DELETED...  when we execute DML (INSERT, UPDATE, DELETE) operation then trigger is automatically execute. example : I have three table INWARD , OUTWARD  and ALLTYPESTOCK OK. so when i insert data in "inward" table then data insert not only inward but also in "alltypestock" table. and same situation with outward...  SO task is data of both table is store in ALLTYPESTOCK table, when i want to chage(update)  any data  of alltypestock then automatically data update which came form the table . UPDATE TRIGGER:                                                                  ------------------- INWARDSTOCK                       ...

Insert Data in Database (mssql)

Image
How TO Insert Data In MSsql DataBase with ASP.NET (C#). So let's Start Now...  You must do 5 steps for insert, update, and delete (DML)Operations. Step 1: Add " using System.Data.SqlClient ; ". Step 2: Create Object of SqlConnection...  like this..  ( SqlConnection Objname = new SqlConnection(); ) Step 3: Crate Object of SqlCommand.... like this... ( SqlCommand  cmd = new SqlCommannd(); ). Step 4: After create Objects of sqlconnection and sqlcommand You Open the Connection. Like this (Objname.Open() ;) Step 5: Execute your Query... Here Example::::...... -------------------------------------------------------------------------------------------                                                                   Code Start ------------------------------------------------------------------...
This is for beginner...      How to create DATABASE in MSSQL ? CREATE DATABASE databasename      How to use DATABASE in MSSQL ? USE databasename     How to create table in MS-SQL ? CREATE TABLE tablename              (                                                                                    columb_ID INT,                                  column_Name VARCHAR (100),  )                                           ...