Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

insert data to access database c#

string constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|your_DataBase_Name.accdb;";
                   OleDbConnection Con = new OleDbConnection(constr);
                   Con.Open();
                   OleDbCommand com = new OleDbCommand();
                   com.Connection = Con;
                   com = new OleDbCommand("your insert command here", Con);
                   int Num=com.ExecuteNonQuery();
                   if (Num != 0)
                   {
                       MessageBox.Show("Record Successfully Added....", "Add Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                       this.Close();
                   }
                   else
                   {
                       MessageBox.Show("Record is not Added....", "Add Record Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                   }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# comments 
Csharp :: serialize object to json 
Csharp :: c# define array 
Csharp :: c# linq join mutiple 
Csharp :: escape in c# 
Csharp :: c# C# read text from a certain line number from string 
Csharp :: convert xml to json 
Csharp :: change a positive number to negative or a negative number to positive 
Csharp :: using statement c# 
Csharp :: remove numericUpDown arrows 
Csharp :: Proxy in Config 
Csharp :: what dotnet command does 
Csharp :: entity 
Csharp :: how to use date range picker in asp.net C# 
Csharp :: c# generate insert statement from object 
Csharp :: Unity Input Key Message 
Csharp :: unity mathf.clamp 
Csharp :: internal working of ioc container c# 
Csharp :: find the values of dictionaries in C sharp 
Csharp :: unity firebase update nodes rank value by sorting value 
Csharp :: how to hide tree level button when no record found for devexpress child grid view in Winform c# 
Csharp :: Boolean Literals 
Csharp :: How to change color of a column in RDLC report 
Csharp :: unity ar scale 
Csharp :: control shot c# WF 
Csharp :: how to change something in the window using a thread wpf 
Csharp :: C# calling method name 
Csharp :: how to detect a null bool C# 
Csharp :: How to set a Printer Port in C# on a specified Printer 
Csharp :: how to check that a gameobject touches a colour in unity c# 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =