Click here to Skip to main content
15,886,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: String Line formating in C# Pin
OriginalGriff13-May-19 23:38
mveOriginalGriff13-May-19 23:38 
AnswerRe: String Line formating in C# Pin
Eddy Vluggen13-May-19 22:11
professionalEddy Vluggen13-May-19 22:11 
AnswerRe: String Line formating in C# Pin
BillWoodruff13-May-19 23:28
professionalBillWoodruff13-May-19 23:28 
Questioncould someone one know what is the error in( cmnd.ExecuteNonQuery();)at button 3 it doesnt work Pin
Member 1436661013-May-19 6:34
Member 1436661013-May-19 6:34 
AnswerRe: could someone one know what is the error in( cmnd.ExecuteNonQuery();)at button 3 it doesnt work Pin
Dave Kreskowiak13-May-19 7:07
mveDave Kreskowiak13-May-19 7:07 
AnswerRe: could someone one know what is the error in( cmnd.ExecuteNonQuery();)at button 3 it doesnt work Pin
Luc Pattyn13-May-19 9:31
sitebuilderLuc Pattyn13-May-19 9:31 
AnswerRe: could someone one know what is the error in( cmnd.ExecuteNonQuery();)at button 3 it doesnt work Pin
Eddy Vluggen13-May-19 10:12
professionalEddy Vluggen13-May-19 10:12 
Questioncould some Pin
Member 1436661013-May-19 6:31
Member 1436661013-May-19 6:31 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\hesham\Desktop\Database2.accdb");
        OleDbDataAdapter da;
        DataTable dt = new DataTable();
        OleDbCommand cmnd;
        public Form1()
        {
            InitializeComponent();
            filldatagridview();
        }
        void filldatagridview()
        {
            dt.Clear();
            da = new OleDbDataAdapter("Select * From Table1 ", cn);
            da.Fill(dt);
            dataGridView1.DataSource = dt;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            cmnd = new OleDbCommand("insert into Table1 values('" + textBox4.Text + "','" + textBox3.Text + "'," + Convert.ToInt32(textBox1.Text) + ",'" + textBox2.Text + "')", cn);
            cn.Open();
            cmnd.ExecuteNonQuery();
            cn.Close();
            filldatagridview();
            MessageBox.Show("added success ", "add", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            textBox4.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            textBox3.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
            textBox1.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            textBox2.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            cmnd = new OleDbCommand("Update Table1 Set name ='" + textBox3.Text + "',age = '" + Convert.ToInt32(textBox1.Text) + "', address='" + textBox2.Text + "'Where id='" + textBox4.Text + "", cn);
            cn.Open();
            cmnd.ExecuteNonQuery();
            cn.Close();
            filldatagridview();
            MessageBox.Show("edit success ", "edit", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            cmnd = new OleDbCommand("Delete From Table1 Where id='" + textBox4.Text + "", cn);
          
            cn.Open();
            cmnd.ExecuteNonQuery();
          
            cn.Close();
            filldatagridview();
            MessageBox.Show("delete success ", "delete", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }

        private void button4_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}

AnswerRe: could some Pin
Dave Kreskowiak13-May-19 7:03
mveDave Kreskowiak13-May-19 7:03 
QuestionHow to Read RPM from CANBUS data using a GUI Pin
firoz kamarudin12-May-19 22:05
firoz kamarudin12-May-19 22:05 
AnswerRe: How to Read RPM from CANBUS data using a GUI Pin
phil.o13-May-19 1:02
professionalphil.o13-May-19 1:02 
GeneralRe: How to Read RPM from CANBUS data using a GUI Pin
firoz kamarudin13-May-19 17:56
firoz kamarudin13-May-19 17:56 
QuestionFinal Project its importent Pin
Member 1436409711-May-19 13:54
Member 1436409711-May-19 13:54 
AnswerRe: Final Project its importent Pin
Dave Kreskowiak11-May-19 14:23
mveDave Kreskowiak11-May-19 14:23 
AnswerRe: Final Project its importent Pin
BillWoodruff11-May-19 14:27
professionalBillWoodruff11-May-19 14:27 
AnswerRe: Final Project its importent Pin
OriginalGriff11-May-19 20:06
mveOriginalGriff11-May-19 20:06 
AnswerRe: Final Project its importent Pin
Gerry Schmitz11-May-19 23:49
mveGerry Schmitz11-May-19 23:49 
AnswerRe: Final Project its importent Pin
#realJSOP12-May-19 1:10
mve#realJSOP12-May-19 1:10 
QuestionIdeas wanted: editor for large parent-child tree structure in multiuser environment Pin
atrus271111-May-19 3:01
atrus271111-May-19 3:01 
AnswerRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
BillWoodruff11-May-19 14:45
professionalBillWoodruff11-May-19 14:45 
GeneralRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
atrus271113-May-19 2:01
atrus271113-May-19 2:01 
GeneralRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
BillWoodruff13-May-19 20:53
professionalBillWoodruff13-May-19 20:53 
AnswerRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
Eddy Vluggen11-May-19 23:13
professionalEddy Vluggen11-May-19 23:13 
GeneralRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
atrus271113-May-19 2:17
atrus271113-May-19 2:17 
GeneralRe: Ideas wanted: editor for large parent-child tree structure in multiuser environment Pin
Eddy Vluggen13-May-19 3:29
professionalEddy Vluggen13-May-19 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.