Posts

Showing posts from August, 2017

How to pass data through variables and insert the values into database table using SqlCommand Statement with C#

Let's create our table first: CREATE TABLE [dbo] . [Member] (     [Id] [int] NULL,     [Name] [varchar] ( 60 ) NULL,     [Dob] [date] NULL,      [Email] [varchar] ( 80 ) NULL,      [Phone] [Nvarchar] ( 20 ) NULL ) The below C# script can be used to insert the variable values to “dbo.Member” table just created . using  System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using System.IO; namespace DataWorldWithGbengaOridupa.com_CSharp_Tutorial {     class Program     {         static void Main( string [] args)         {             //The datetime and Log folder will be used for error log file in case of error. It is important.             string datetime = DateTime.Now.ToString( "yyyyMMddHHmmss" );             string LogFolder = @"C:\Log\";             try             {                 //Create C