Skip to content

Instantly share code, notes, and snippets.

@harshityadav95
harshityadav95 / save_record_access
Created July 30, 2016 11:39
C# Save A Access Record into the database from the values accepted by the user .
try
{
obj1.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = obj1;
MessageBox.Show("Login Succesfull");
//Throwing exception when enteringg data into the same databse
//command.CommandText = "insert into empdata (ID,empname,phone,dob,password) values('" + textBox.Text + "','" + textBox1.Text + "','"+ textBox3.Text + "','"+ textBox4 .Text+ "','"+ textBox2.Text + "')";
@harshityadav95
harshityadav95 / code.cs
Created July 29, 2016 12:25
C# code from Finsar Sqlite to create an Sqlite database and insert some values it no it and display them in a message box
// [snip] - As C# is purely object-oriented the following lines must be put into a class:
// We use these three SQLite objects:
SQLiteConnection sqlite_conn;
SQLiteCommand sqlite_cmd;
SQLiteDataReader sqlite_datareader;
// create a new database connection:
sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;New=True;Compress=True;");
@harshityadav95
harshityadav95 / Code.cs
Created July 29, 2016 12:22
Code to Insert data into the Excel File using C# application using Google Code ExcelLibrary
using ExcelLibrary.CompoundDocumentFormat;
using ExcelLibrary.SpreadSheet;
string file = "newdoc.xls";
Workbook workbook = new Workbook();
Worksheet worksheet = new Worksheet("First Sheet");
worksheet.Cells[0, 1] = new Cell((short)1);
worksheet.Cells[2, 0] = new Cell(9999999);
worksheet.Cells[3, 3] = new Cell((decimal)3.45);
worksheet.Cells[2, 2] = new Cell("Text string");