Click here to Skip to main content
13,091,134 members (93,259 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi! First of all I need know how Can ı do select delete and update operation on Datagrid shortcut.

I fill data like this

sql_cmd = sqLiteConnection1.CreateCommand();
            string CommandText = "Select * From PLU";
            DA = new SQLiteDataAdapter(CommandText, sqLiteConnection1);
            DT = DS4.Tables[0];
            dataGridView4.DataSource = DT;

DA:DataAdapter, DS4:DataSet, DT:DataTable

Can anybody help me?
Posted 27-Mar-13 4:09am
Sergey Alexandrovich Kryukov 27-Mar-13 10:16am
How about just reading the MDSN documentation on this control?
OsmanAydogan 27-Mar-13 10:52am
What MSDN Documentation?
Sergey Alexandrovich Kryukov 27-Mar-13 10:56am
Did you ever pressed F1 for help? :-)
OsmanAydogan 27-Mar-13 11:01am
Come on!:D
Sergey Alexandrovich Kryukov 27-Mar-13 11:08am
OK, your English is good enough :-)
Than you know what is MSDN documentation, right. Why not using it?
OsmanAydogan 27-Mar-13 11:13am
Ok Ok ı'll try it but :D
Sergey Alexandrovich Kryukov 27-Mar-13 11:16am
Great. Come close to the solution and please ask more specific question in case you are stuck.
Good luck.
OsmanAydogan 27-Mar-13 11:35am
Ok Sergey but I have a problem?
exactly I dont know what is my problem?
What should ı say? :S
Sergey Alexandrovich Kryukov 27-Mar-13 11:48am
You need to formulate it the way anyone could be able to find end. Use the debugger to see what's going on.
If you can show the code, is should be comprehensive and build. So make a very short code focusing on only on problem. Explain what it does and what is should do but fail. Something like that.
OsmanAydogan 27-Mar-13 12:55pm
ThePhantomUpvoter 27-Mar-13 10:31am
What is a "Datagrid shortcut"?
OsmanAydogan 27-Mar-13 10:52am
Datagrid! Datagrid!
what is the datagrid shortcut? hmm its wrong sorry! I dont know very well english.
Sergey Alexandrovich Kryukov 27-Mar-13 10:57am
It's OK. You still can read the above question. First of all, provide fully qualified type name for "DataGrid", tag your UI library or application type.
ThePhantomUpvoter 27-Mar-13 11:14am
Besides that... you do not do CRUD operations on the datagrid. You would do your CRUD operations on your database. Just like you are doing with this SELECT on your SQL Lite database.
OsmanAydogan 27-Mar-13 11:18am
CRUD Operation?
Maciej Los 27-Mar-13 15:05pm
DataGrid is WinForm or Web control? It's very important to define it.
OsmanAydogan 28-Mar-13 3:59am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Your question is not well-formed and it's hard to answer it...

The DataGridView control[^] provides a powerful and flexible way to display data in a tabular format. You can use the DataGridView control to show read-only views of a small amount of data, or you can scale it to show editable views of very large sets of data.

You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. For example, you can programmatically specify your own sorting algorithms, and you can create your own types of cells. You can easily customize the appearance of the DataGridView control by choosing among several properties. Many types of data stores can be used as a data source, or the DataGridView control can operate with no data source bound to it.

More about: DataGridView class[^]
DataEntry in the DatagridView control[^]

So, you can't "select delete and update operation on Datagrid shortcut" - whatever it means.

To manipulate data, you need to use ADO.NET[^].
ADO.NET separates data access from data manipulation into discrete components that can be used separately or in tandem. ADO.NET includes .NET Framework data providers for connecting to a database, executing commands, and retrieving results.

More about:
Overview of ADO.NET[^]
Writing Common Code for .NET Framework...[^]
ADO.NET Sample Application[^]

Please, read these articles, then ask a question again (if any).
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


First I want to say that the better way to do what you need is with the dataset (XSD) object.
You can add one threw the add -> new item... and then chose dataset.
In the past I did it like you do now but it is much easier to manage the tables and their boundings (datagrid, combobox, etc') with the dataset.

Second the code that you look for is this:
SqlCommandBuilder b = new SqlCommandBuilder(_sdataadapter);

After you do all the things you need (add, update , delete) run this and it will update your data base.

usually it is preferred to do those operation separately it works fine together,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100