Saturday, December 9, 2017

SQL Datatype

SQL DataType

1. BigInt
    From C# side it stores Int64 Value
    MaxValue = 9223372036854775807
    MinValue = -9223372036854775808


2. Bit
    C# : Store Bool Value Like True or False 
 
3. DateTime
    C# : Store Date Time

4. Float
    C# : Store Float Value
    MaxValue = 3.40282e+038f
    MinValue = -3.40282e+038f


5. Int
    C# : Store Int32 Value
    MaxValue = 2147483647
    MinValue = -2147483648


6. Numeric(18,0)
    SQL store value like 18 digits with 2 or more decimal place
    e.g. 12.00


7. Nvarchar(50)
    SQL store Text & unique code value with limited size

8. Nvarchar(MAX)
    SQL store Text & unique code value no limit for store data

9. Varchar(50)
    SQL store only text Varchar datatype do not support unique code value

10. Varchar(MAX)
    SQL store only text Varchar datatype do not support unique code value

11. Uniqueidentifier
    SQL store Numeric, Characters, and - with the lenth of 36 characters
    Uniqueidentifier do not repeat it generate unique value every time
    C# : store GUID value

How to Install SQL Sever 2008 R2?

How to Install SQL Sever 2008 R2?

=>   Sql Server Installation Step Follow Bellow : - 

1) First of all download sql server management studio 2008 then click setup see image 


2) Second step display installation dialog box see image


3) Third step display SQL Server Installation Center Then select "New Installation or add features to an existing installation" Text click see image



4) Then display setup support  rules dialog box see image


5) This step is display license terms then by default two checkbox is unselected display see image


6) This step is select two checkbox then enable next button see image


7) This step is display feature selection then click next button see image


8) This step is display error reporting dialog then click next button see image



9) This step is display complete installation see image 


10) This step is display your setup is ready to user create new database see image



How to setup in visual studio 2013,2017 ?

How to setup in visual studio 2013,2017

                                                                   This article is explain how to setup in visual studio 2013.First of all download visual studio 2013 setup then follow step below.

1) First of all setup double click 


2) Then open visual studio 2013 dialog box then click continue button show below image.


3) Third step is by default path is set "C:\Program Files\Microsoft Visual Studio 12.0". it can change path and set new path otherwise default path store all file and setup data.

                                         Third step display "I Agree to the License Terms and Privacy Policy"
Checkbox by default un-selected display then select checkbox to display Next button.see image



4) Then Click Next Button see Image.


5) Fifth step display "Optional features to install" by default all selected. then click Install Button.See image



6) Six step is display progress bar in i think 40 minute process to install visual studio 2013 data.waiting in 40 minutes see image

7) Congratulation your setup is completed install and display dialog see image

8) Then click "LAUNCH" text 

9) Nine step to display  "Welcome Sign in to Visual Studio." then click "Not now,Maybe later " text.see image


10) This step is choose your color theme.there are three theme display
  1.  Blue
  2. Dark
  3. Light
Select a Blue color theme then click Start Visual Studio. see image


11) This step is display waiting few minute see image


12) Finally all process is finish display visual studio 2013 dialog.your are create own web application,Software etc.see image

Serial Port with Efficient Data reading in C#



  • I am  not good at writing but below is few from my collection.
  • Declare the Port variable globally in a form.


    1. SerialPort Port;   
    2. string PORT_NUMBER = "YOUR PORT NUMBER" ;   
  • Set the port properties in Form load. 

try  
{  
   Port = new SerialPort("COM" + PORT_NUMBER.ToString());  
   Port.BaudRate = 115200;  
   Port.DataBits = 8;  
   Port.Parity = Parity.None;  
   Port.StopBits = StopBits.One;  
   Port.Handshake = Handshake.None;  
   Port.DtrEnable = true;  
   Port.NewLine = Environment.NewLine;  
   Port.ReceivedBytesThreshold = 1024;  
   Port.Open();  
  
}  
catch (Exception ex)  
{  
   MessageBox.Show("Error accessing port." + Environment.NewLine + ex.Message, "Port Error!!!", MessageBoxButtons.OK);  
   Port.Dispose();  
   Application.Exit();  
}   
  
  • Above is the basic procedure and easy to understand.
  • Now create following function which will be helpful to read data from serial port simultaneously. 

private void ReadEvent()  
{
byte[] buffer = new byte[2000];  
Action kickoffRead = null;  
kickoffRead = (Action)(() => Port.BaseStream.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult ar)  
{  
    try  
    {  
        int count = Port.BaseStream.EndRead(ar);  
        byte[] dst = new byte[count];  
        Buffer.BlockCopy(buffer, 0, dst, 0, count);  
        RaiseAppSerialDataEvent(dst);  
    }  
    catch (Exception exception)  
    {  
        MessageBox.Show(ERROR == > " + exception.ToString());    
    }  
    kickoffRead();  
}, null)); kickoffRead();  
}  

    //To decode the received data from the port.   
    private void RaiseAppSerialDataEvent(byte[] Data)  
    {  
        string Result = Encoding.Default.GetString(Data);  
         TextBox1.Invoke((Action)delegate   
    {  
       TextBox1.Text=Result; TextBox1.Refresh();   
    });   
    }  



    It will keep assigning same event when data received.

    Port.BaseStream.BeginRead 

    Never fails and will give you each and every bit from the Port.
    To invoke this you need to Call Port.WriteLine("AT COMMAND");
    Hope it helps someone who is stuck with ports.
     

    Sunday, December 3, 2017

    How to pass and get value in query string asp.net

    One page to another page pass value in query string :

    First pass value in query string: 

    Response.Redirect("QueryString.aspx?QueryString=" + txtQueryString.Text);

    Get QuerySting value in Asp.net:
     QueryString.Text = Request.QueryString["QueryString"];