C# Insert Update Delete View and Search
Вставка
- Опубліковано 11 вер 2024
- The tutorial shows how to do Insert Update Delete View and Search in c# windows forms for beginners.
C# beginners tutorial on how to do insert, Update, Delete, View and Search Or Insert, Edit, Delete, View Operations in c# windows form using data grid view and SQL server.
all these insert edit view and search operations are done using SQL Server stored procedure.
📂 GitHub Repository
► goo.gl/kFx8A3
💖 Buy me a Coffee
➤ bit.ly/3L36ut4 (PayPal)
➤ bit.ly/3VF0iPT (Razorpay)
🌀 Related Videos
goo.gl/FxwPXb : C# String Vs StringBuilder.
goo.gl/KeeYku : Code execution time in C#.
🔗 Find me in
Udemy : bit.ly/3RtyQSB
Facebook : / codaffection
GitHub : github.com/cod...
Discord : / discord
Twitter : / codaffection
#WinForm #WindowsForm #CodAffection
goo.gl/RFY5C2 : Subscribe to CodAffection
goo.gl/NhNQeZ : Export Excel in C# Applications
goo.gl/WsgPbp : C# User Registration With DB
goo.gl/G6WRQR : C# Login Window
I know im randomly asking but does any of you know a method to log back into an Instagram account??
I stupidly forgot the password. I appreciate any assistance you can offer me
People like you are lifesavers! Very clear tutorial. You have a lot of patience explaining all the steps in this tutorial. Thanks!!
Thanks for your wonderful feedback. let me know if your topic suggestion like this C#/ sql tutorial.
Thank you my good man. This video has helped me a lot for my final projects. One of the best tutorial videos for C# hands down
Excellent Tutorial; must admit you are a great teacher. Keep up the good work.
Thank you, very clear and good explanation. Can't wait to try it.
glad to hear that, thanks for the comment
this is very helpful for my Assessment Brief. Thank you so much. From Philippines!
Great tutorial! Thank you!!
great video, really happy i found this video as it saved me a lot of trouble
Hey man Im new to Programming, Databases and other things related to it
thankyou for making this video it helped me a lot kudos
Thanks, You Help ME Lots Thanks For Your Help
Best Crud operations i have everseen.
Thanks for your kind words.
@@CodAffection Sir if you don't mind.
I need your help as my FYP is very close.
Very Helpful Video ^-^
Thank you so much....
Helped me a lot
Thank you sir it's very helpful video.
from egypt and follow u of c# ..
thanks of videos learn
Mero Moro : thank you very much.
great tutorial, I forgot to update the Stored Procedure and my stuff was not updating hehe
Its really helpful.Sir i have created the database application but the forms does not open in full window mode. I need to maximize each form again and again. Please suggest something how can i make all forms in full window mode.
Very helpful. Thank you
Thank you for the tutorial!
Best teacher u r..u discussed so nicely even simple things...best way u taught...so calmly ..wow ..best u r..may i know ur name sir.?
Thanks for your wonderful feedback!.
We need.more n more such videos to command c# dotnet sir...i need ur help personally
thank you so much. awesome guidance
Awesome! Thanks a lot!
Love From Vietnam
This has been super helpful. Thanks so much!
My Pleasure.
Thanks a lot for the help and information, good presentation
glad to see your comment. keep learning and sharing.
Great Man Thank you so much
You're welcome!
This is very helpful. Thanks a lot 😊😃😃
I am glad to hear that
It was a lot of Help Thanks!
Thanks so much :) Really helped me.
Where does ContactName from stored procedures named contactviewor search came from
I m with this problem too
THANK YOU SO MUCH YOU ARE MY HERO
on @36:24 if we double click the blank datagridview after we run the program, its error, any idea how we not using if(dgvContacts.CurretnRow,Index != -1)? because
on your example you click search to show the datagridview, but if we click blank datagridview after run the program, it error on that code above, Thank you for the great video :), this is most complete
Thanks for catching that.
@@CodAffection your welcome, but yes i still hoping the answer :D if you dont mind, thank you for great video
good experiance
Hai sir, this is really awesome and more easy to do and I have implemented it in my project it's working too good. Thank you so much sir. And I need a help from you sir because I am doing a school management project so that I need to include attendance process but I referred lot of videos still I didn't get apt full like this video. Please sir just upload a video of how to process attendance concept in Windows form using c# or suggest me some videos sir. It's urgent for me sir. Plsssss
Thanks for the comment. Now I don't have a video for school management software.
Excellent!! Very usefull
Thank you very much...
Its was very helpful..!!!
My pleasure, Thanks for the comment.
just perfect, thanks a lot.
Glad you found the video helpful.
thank you :)
thank u so much
it is helpful
I'm glad you liked it, thanks for watching
thank you very much :) :)
+maher koosa :)
love you
Pls help me out,not able to insert values....ur video helped a lot ,but not able to insert values
thanks for the video...its very useful.plz add date and combobox too..
sure
Thanks for this. Sir, Please add Radio button and combo box also .. Thanks in advance.
sure
try this new video : ua-cam.com/video/1kT3KaZcNn8/v-deo.html
thanksss so much!
I'm glad I helped
Hey, @18:44 why is your connection string's data source=.\SQLEXPRESS?
mine is Data Source=(LocalDB)\MSSQLLocalDB;
I already have sql server but why is my connection like that sir?
Values are not being saved in my database during the AddOrEdit procedure part. I followed everything, except it is not saving on the database
Can anyone give me a solution to edit all data which is populated from the Data table(in database) to Datagridview and update the whole edited data into the same Data table .(Update query)
Hi, i just have one problem, when i update one contact it updates all other contacts with the same information
Lovey super
Load of property'RootNamespace 'failed. The string for the root namespace must be a valid identifier.
Sir how can i solve this error
hello mate, can you upload a video about how to upload a bulk of data to sql server from ms access in c# and also download a bulk of data from sql server to ms access file in c#
an old video, it might help : ua-cam.com/video/sBpNkjdRpno/v-deo.html
@@CodAffection thanks a lot mate
how to insert and update data in just one button(save) in C# // I need some help
Where are the ContactName, in 'search button'? i cant find him
How do we deploy/publish this to the client machine?
I get error in stored procedure plzzz 😢
AS line num 8 ?
Can you help me ? I have a problem when I run the program, after double click on the DataGridView I see the error:
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
this corresponds to:
CONTACTID = Convert.ToInt32 (dgvContacts.CurrentRow.Cells [0] .Value.ToString ());
How can I convert it?
ContactID in my SQL as an integer
Przemek Otczyk can u put a break point in double click event then find out the exact line that cause the exception
Error cannot insert the value NULL into column 'ContactId'
when search is can't find the item it errors...
please help me on step by step working and introduction on C# form application
hi there @Dotnet Mob, i got stuck in the situation where in if i click the record and wont proceed on the edit..then if i click the reset button and enter supposedly a new record..it wont save as new..instead it will show the update message thus updates the last clicked record instead of making a new one..i hardly need help..tnx!
Sure, Please put a breakpoint in datagridview row click event and then run. let me check in my side.and it is a double click event not a click event.
let me know if you need more clarification.
yes i do man..the if else loop wont work..it wont read if button text is "save" or "update"
when i run the project..it perfectly saves every data..after each saving..but when i click the table to update a record..after that if i click reset..the new datas will no longer be save..it will show as update..
yes it was set as doubleclick as well here in my end
Any chance to get a way to check if name already exists? Rigth now its possible to have duplicated entries.
yes of-course.
Thanks, ill be waiting for it :P
Why whatever I do, It gives me an exception saying "stored procedures not found"...When I save it, I have to choose where, when you did, you did not have to choose..
ua-cam.com/video/-2UcDV4uUu8/v-deo.htmlm34s
Pass your stored procedure name as parameter to SqlCommand. I hope you have downloaded the source code.
Sir, not able to insert values
Hello. Everything works fine except that it only allows me to save one record in the table. After that I receive an error about duplicate primary key. Please note that I did download the project and I adapted it to my project. If you have any suggestions on solving this, please reply. Thanks
did you set the id column as identity column - in video it was there at 10:30
yup. here is the syntax
CREATE TABLE [dbo].[train_lines] (
[Id_TL] INT IDENTITY (1, 1) NOT NULL,
[tl_name] VARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([Id_TL] ASC),
);
Ah, found the problem. In the Add stored procedure I had:
IF @mode = 'LJ_Add'
BEGIN
INSERT INTO train_lines
(Id_TL, tl_name)
VALUES
(@Id_TL,@tl_name);
END
I deleted the Id_TL from insert and values and now it works fine. Thank you for replying anyway.
That's how it happens usually, as soon as you ask for help, you find the problem :))
how do you get the command : FILLDATAGRIDVIEW ???
Where is the code to download please ?
Its working fine in my PC, but unable to run in another PC. I am getting instance specific error related to database, plz help.
try this stackoverflow.com/questions/11278114/enable-remote-connections-for-sql-server-express-2012
dgvContacts.DataSource = dtbl
It is giving me an error call "dgv does not exist in the current context" what can i do for that??? Am I use any packages or something??? please help me to sort out my problem...
dgv ? what is the name of datagridview dgvContacts or dgv ? try to run in debug mode.
Hi, I have got error "Could not find stored procedure" I'm using VS 2017 and i can't type sqlCmd.CommandType = CommandType.StoredProcedure; VS says i need to do like this sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;. i think this is a problem but i don't know solution
use required namespace.
add following namespace
using System.Data;
Thanks for great video.
I wanted to create column header with space: [Mobile Number] and I could not save the store procedure. If these two words are together, everything works fine. Can anyone help me?
did you create a column with name 'Mobile Number' ? and now you have a problem with creating stored procedure right ?
Yes, I did. Because there is space between these two words, during creation of column name, "Mobile Number" is automatically inserted between [ ]. And than I tried to use same content [Mobile Number] in stored procedure and there is error.
8:24
error: an attempt to attach an auto-named database for file...
verify the spaces in the middle of your folders
How can I transfer this application to another computer without having problems? I get problems with LocalDB and then the attachment database etc .. how can I solve? I just want to make the application work like your video on another computer without having to install special programs. Please help me it's been 4 days since I can not solve the problem. Thanks in advance.
I hope you have installed MS SQL Server on new computer, Then you may need to change Db connection string. Please watch this video for building connection string : ua-cam.com/video/WJ-CdeTGxp8/v-deo.html
On the new computer I do not have MS SQL Server. Can you send me the link where to download MS SQL SERVER to the new computer and which edition? I can not understand what the right link is.
where is the sql file of this project?
i'm having a problem with delete and update button .
like if I update a data it does not update in grid view or table and same with delete button
and filldatagridview function is not available in my c# library it does not exist in the current content
did you download demo project source code ?
Dotnet Mob No I didn't
please download demo project and try.
Dotnet Mob thank you
it helped alot :)
Can please guide where I can find sale system ? with this procedure?
I have a project to submit tomorrow and I can't find it :(
I didn't get you. What project ? Let me know project requirements.
if (dataGridView1.CurrentRow.Index i= -1), i am having trouble with this line, what am i doing wrong?
i= or != ?
How do i save the database
Hello ? can i ask why i don't have FillDataGridView in 32:28 thank you
i get it i got a wrong put in my void FDGV haha sorry
How to make gridView get the search results simply by typing a letter in a textbox without pressing any SEARCH button?
Implement keypress event on textbox instead of search button click event.
dgvContacts.DataSource = dt;
Error : Error 1 The name 'dgvContacts' does not exist in the current context
plz help me
please download the demo project and compare with yours.
Could not find stored procedure please i need a help in this error
fixed ?
no :( please help me
Thanks for this but my delete button is not supporting
Any error message ?
Search?
Can you help me? I just did what your tutorials but I keep receiving this error "Cannot insert explicit value for Identity column in table 'EMPLOYEES' when IDENTITY_INSERT is set to OFF" can you help me about this pls?
sure,
fix : in the insert sql script - avoid employee id column(identity column)
reason : you can't insert values into identity column directly
I hope you downloaded my project from the link given in video description
Thanks for the reply I'll try it later and I will tell you the result later.. Nice channel by the way nice to subscribe..
sir I'm sorry I am really a beginner with C# I just download the link from your videos description and just follow the ID column that you made with primary key and now I'am confuse... sorry for disturbing you... but can you help me understand about this.. I mean I understand your C# tutorials but I dont know what happened with my sql syntax...
can i see you stored procedure for employee insertion ?
if possible please share the table design also
yes sir where could I share it to you?
When i press search i don't see the whole table.Anyone knows why ?
whole table ? empty datagridview ?
This program deletes only first(0) person?
yes ,only one person. person with given id.
Dotnet Mob No, I am about first in index? Or i can choose with index 18 ?
or the table thingy
dgvContacts where it is
How can i import file sql into program?
you mean sql script file?
Please check your inbox
how to work in search ber option ????
search text box is used to filter records from inserted records. it is already implemented in this project.
ohh..thanks for your informative reply
how to create setup from project
you can expect that in upcoming tutorials
Video As Per Your Request.
ua-cam.com/video/tiHBwAp_Kz4/v-deo.html
Basic approach, Improve
KIND SOURCE code b de dain
I think, it's there in video description.
GGWP
:)
please send me source code of this?
you can download the source code from the link given in video description.if you need any help let me know
where is link.?
www.dropbox.com/s/6kft17y18hp5ng0/Save%20Update%20Delete%20View.zip?dl=0
It is does't work
:(
did you download the project ? any error message ?
I downloaded the software but I did exactly same that you, and visual studio shows me :" An attempt to attach an auto named database for file C:\Users\MyUser\Documents\BD_CONTACTAPP\ContactDB.mdf failes. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share"
thanks, I have found the answer !!! the issue is in my directory, vs had a big bug!!!
thank you very much for watching my video,
next time I will make a separate video on how to use demo project source code and db script
2trigered mic!!!!!!11
lol
Rrrrigt