C# Tutorial - Insert Update Delete Search data from local database | FoxLearn

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • Material Design Telephone Diary/Phone Book Insert Update Delete View and Search data from local database in C# using material skin. The C# Basics beginner course is a free C# Tutorial Series that helps beginning programmers learn the basics of the C# Programming Language
    Website: foxlearn.com
    insert update delete c# sql server
    Insert Update Delete View and search data from database in C#.net
    Fully C# Save, Insert, Update, Delete, View, Search, Clear in Visual studio
    C# Insert Update Delete and View data from database in .net
    Insert update delete select in c#
    insert update delete data in database from datagridview
    Update and Insert data in database from datagridview
    Insert Update Delete and Search Data in local databases Using CSharp

Komentáře • 368

  • @albertlucero2590
    @albertlucero2590 Před 7 lety +5

    how to fix this error message
    cannot insert explicit value for identity column in table PhoneBooks when identity_insert is set to off

  • @LarGriff
    @LarGriff Před 7 lety +7

    "Cannot insert explicit value for identity column in table 'PhoneBooks' when IDENTITY_INSERT is set to OFF"
    I see a lot of people having the same problem, but I still don't understand the solution. Please explain in detail how to fix this. Thank you!

    • @michaeleilers3438
      @michaeleilers3438 Před 2 lety

      Solution that I found was updating the Identity Specification from FALSE to TRUE. The person does this at around the 6:39 mark. Dont know how I missed it.

  • @straich0434
    @straich0434 Před 5 lety +1

    I do not know if anyone still watches this but what worked for me for the "IDENTITY_INSERT is set to OFF" error is to simply rebuild the table adapter. It is a very easy process, just google it.

    • @foxlearn
      @foxlearn  Před 5 lety

      Thank you !

    • @knives5972
      @knives5972 Před 3 lety

      hi. could you tell me how? I cannot find the answer in google.. sorry

  • @AAAAAAAAAAAAANDREW
    @AAAAAAAAAAAAANDREW Před 6 lety +5

    It's almost great video, except few bugs. BUT i can't solve a problem with SAVING data. Also, I have allready solved problem with IDENTITY - just by putting string "appData.PhoneBooks.AcceptChanges();" after "phoneBooksBindingSource.EndEdit();"
    BUT data is saving only in the Grid and don't saving in DataBase. After app restart - there are no data that I "saved".
    HELP, please!

    • @nervolnervol349
      @nervolnervol349 Před 4 lety

      docs.microsoft.com/ru-ru/visualstudio/data-tools/save-data-back-to-the-database?view=vs-2019

  • @abdulrahmanrefaei1023
    @abdulrahmanrefaei1023 Před 7 lety +1

    Nice work ! Would you please make more videos about local database print , how to add pictures thank you

  • @andresescorcia6587
    @andresescorcia6587 Před 7 lety +1

    I already checked the code, the mistake is that parameters you inserted on "string.format" are textboxes that shows the information, So you should use is the searching's textbox.

  • @dschmitz71
    @dschmitz71 Před 4 lety

    A great tutorial where I learned a lot.
    First I forgot the AutoIncrement settings on the tables and the data was not saved. But I fixed that.
    Now I always get the error "IDENTITY_INSERT is set to OFF".
    I would be glad about a help.

    • @dschmitz71
      @dschmitz71 Před 4 lety

      Cannot insert sxplicit value for identity Column in Table … when IDENTITY_INSERT ist set to OFF

    • @foxlearn
      @foxlearn  Před 4 lety

      That's great. Thank you !

    • @dschmitz71
      @dschmitz71 Před 4 lety

      @@foxlearn : Can you help with the Problem: "Cannot insert explicit value for identity Column in Table … when IDENTITY_INSERT ist set to OFF" ? Can you please send me the Code t: dschmitz71@hotmail.com

  • @baddragonfire
    @baddragonfire Před 7 lety +2

    followed the tutorial but keep getting the "cannot insert explicit value for identity column in table 'phonebooks' when IDENTITY_INSERT is set to OFF" any help?

    • @baddragonfire
      @baddragonfire Před 7 lety

      For somereason after completly restarting visual stuidos everything started to work fine. Just incase someone needs help.

    • @AAAAAAAAAAAAANDREW
      @AAAAAAAAAAAAANDREW Před 6 lety +2

      I have allready solved problem with IDENTITY - just by putting string "appData.PhoneBooks.AcceptChanges();" after "phoneBooksBindingSource.EndEdit();"
      BUT data is saving only in the Grid and don't saving in DataBase. After app restart - there are no data that I "saved".

  • @d_range211
    @d_range211 Před 3 lety

    Wish there was more narrative and explanation 😉

  • @BustaJunix
    @BustaJunix Před 4 lety

    Very informative and Great video. How to add a code for validating an existing record in database to avoid duplication of record. Thank you very much. Very new to the C# and learning by video.

    • @foxlearn
      @foxlearn  Před 4 lety

      Thank you !

    • @BustaJunix
      @BustaJunix Před 4 lety

      @@foxlearn Welcome. Hoping soon for another informative tutorial

  • @Saulred700
    @Saulred700 Před 7 lety

    Hi, I would like to know how do I search multiple data, for example, If I have two entries by the name "Anna" and I would like to search for Anna,How do I Show both datas, because I am only able to show the first anna that the program searchs.

  • @Hmoobtwjcuabchanel
    @Hmoobtwjcuabchanel Před 7 lety +4

    How to fix Cannot insert explicit value for identity column when set identity off

    • @taufiqrahman2363
      @taufiqrahman2363 Před 7 lety

      Do you have the code?

    • @foxlearn
      @foxlearn  Před 7 lety +3

      Hi, You should set identity on. Please try again

    • @yassineaissaoui4143
      @yassineaissaoui4143 Před 7 lety

      how to set identity on please?
      i have problem Cannot insert explicit value for identity

    • @TrqHsn
      @TrqHsn Před 7 lety

      I also have that problem... What should i do to solve it?

    • @sambo7849
      @sambo7849 Před 6 lety

      You can set it yourself here 6:30

  • @dlaregalaipo5516
    @dlaregalaipo5516 Před 7 lety

    also is there a way to validate if the record already exist to avoid duplication or record... tnx in advance

  • @vautek
    @vautek Před 4 lety +1

    As usual nice work Fox, one of the posts in the past had a fix for PhoneBooks' when IDENTITY_INSERT is set to OFF I eventually tried it, it worked for me, I am not sure if it has affected any other part of the project. I have added an example below.
    Ok just test and it looks like it is not saving to data bass.
    private void btnSave_Click(object sender, EventArgs e)
    {
    try
    {
    Edit(false);
    phoneBooksBindingSource.EndEdit();
    phoneBooksTableAdapter.Update(appData.PhoneBooks);
    dataGridView.Refresh();
    txtPhoneNumber.Focus();
    MessageBox.Show("Your data has been successfully saved.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    appData.MemberDetails.RejectChanges();
    }
    }
    Ok just test after posting and it looks like it is not saving to the data base.

    • @foxlearn
      @foxlearn  Před 4 lety

      You should copy your database to another folder. Each time you rebuild your project all data in debug folder will be deleted.

    • @vautek
      @vautek Před 4 lety

      @@foxlearn I have not rebuilt since I finished, I am now trying to use and it will not save. I click NEW then add details and then click SAVE I can add many customers ID to list but as I exit the form and open it again the data is not there

  • @sanjaysawant8033
    @sanjaysawant8033 Před 5 lety

    Search functionality not working properly it always shows the first row,can anyone help me for this

  • @michaeleilers3438
    @michaeleilers3438 Před 2 lety

    Your 'SEARCH' feature didnt work correctly. Also, you put in the CANCEL button but did nothing with it.

  • @mavericksfo
    @mavericksfo Před 7 lety

    i am having an issue when i trying to run the .exe of the published program. i get an sql error when running the program on another computer..

  • @darvin1982
    @darvin1982 Před 7 lety

    Hallo Fox Learn,
    danke für deine super Videos, wirklich klasse wie du das alles zeigst.
    Einen kleinen Tipp hätte ich aber - wie wäre es zum Teilen deine Programme Github zu benutzen? Das wäre für dich und deinen Zuschauern wesentlich einfacher. Außerdem müsste Visual Studio 2015 auch eine Github... haben. Also denke ich. :)
    Gruß
    Tobi

    • @foxlearn
      @foxlearn  Před 7 lety

      Thank you for your suggestion. I'm trying to build my website, i'll upload all in my site

  • @ahmedmuntasir2620
    @ahmedmuntasir2620 Před 7 lety

    Hey! Can you show how to add a image in the database. Like I want to add an image with the contact info.

  • @shaisen8572
    @shaisen8572 Před 6 lety

    Thanks for the video. But what is the purpose of materialskin?

  • @waelbenhassine8768
    @waelbenhassine8768 Před 7 lety

    Hello, please i need your help if possible. I'm using one of your video for coding my app from datagrid using sql data base, and i want the same proprieties for one form i'm using as in this video but the code you used is adapted for a local database. How i can adapt it for sql please? i'll appreciate your help and thank you so much for sharing all this.

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You can reference videos czcams.com/video/d4-DYhaGFvQ/video.html , czcams.com/video/TRH7rm8ozD4/video.html . Thank you

  • @SadSadDeadM
    @SadSadDeadM Před 7 lety

    I'm getting lots of errors refering to Form1.Designer.cs (Designer window display those errors) and also I'm getting error about AppData that there is no type or namespace like AppData.
    Does anyone knows how to solve those problems?

  • @Sylvethrin
    @Sylvethrin Před 7 lety

    Hello, when I use commands like phoneBooksTableAdapter.Update(appData.PhoneBooks) or Message.Show(....) I get errors. For example in the Message case I get " 'Message' does not contain a definition for 'Show' ". What is wrong??

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You need create windows form project, check your reference to System.Windows.Form

  • @acvvoi
    @acvvoi Před 7 lety

    Awesome video, very informative and well done. And if I want to install the application in another pc, how can I do that? (it threw me an error)

    • @foxlearn
      @foxlearn  Před 7 lety +1

      OK. Thank you for your suggestion. I'll make the tutorial on this as soon as possible !

    • @acvvoi
      @acvvoi Před 7 lety

      Fox Learn Thanks dude, you have a great channel, subscribed!

  • @draganjatic3460
    @draganjatic3460 Před 7 lety

    I keep getting same error message when trying to save datas "cannot insert explicit value for identity column in table 'phonebooks' when IDENTITY_INSERT is set to OFF". I really don't know what is the problem. I did exactly as it is in the video. I even tried switching from true to false and nothing really happens. Pls help!

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You need to set identity for primary key and the table in your dataset should set auto number is true. please try again. Thanks

  • @nabeelurrehaman8190
    @nabeelurrehaman8190 Před 7 lety

    oswm vedio ...but i have a errror would help me .? the error is
    Cannot insert explicit value for identity column in table 'PhoneBook' when IDENTITY_INSERT is set to OFF.......first time i am using this mathod,,,,

    • @lxgrey07
      @lxgrey07 Před 7 lety

      change your target frame work to ".NET Frame 4.5.1

  • @TumeloMotsoeneng
    @TumeloMotsoeneng Před 6 lety

    HI guys, i managed to solve the Insert Identity issue. Please click on the "dbo.PhoneBooks" plane and under properties switch Identity Column to "Id"

  • @kizaymjumadullayeva4548

    datagrid is not being refreshed...why? pls help me...I used same code and form

  • @NanayaGC
    @NanayaGC Před 7 lety

    What do you use for a Data Time? I have problems with that. Thanks.

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, what error are you getting ?thanks

  • @andresescorcia6587
    @andresescorcia6587 Před 7 lety

    Please review your code, has you noticed that it didn't search the information you typed in.
    Can you please check again the code? Great Video thanks a lot!!!

  • @kaddouraouachria5768
    @kaddouraouachria5768 Před 6 lety

    thank you 1000/1000

  • @andhikautama
    @andhikautama Před 7 lety

    is it possible to do it in excel instead of access??

  • @avi6961
    @avi6961 Před 4 lety

    I have done the same steps as you have shown in the window but still, when I click new and fill the details, they are not shown in the DataGridview. Also, when I again press new there comes an error message "Column id cannot be null".

    • @foxlearn
      @foxlearn  Před 4 lety

      Try to open your dataset, then set the id column to autonumber

    • @Ajaysharma-dt5tj
      @Ajaysharma-dt5tj Před 3 lety

      @@foxlearn Sir i have also the same problem error that occurs -->>Column id cannot be null. and i have also try to solve but i don't get options to set the id column to autonumber

  • @elizgrats1414
    @elizgrats1414 Před 5 lety

    Hello,
    I need your help.
    after searching for the required string, my database does not come to its original position.
    How to fix it?
    thank you in advance .

    • @foxlearn
      @foxlearn  Před 5 lety

      Please try to set position to bindingsource. Thank you !

  • @vikydogphotovideo3370
    @vikydogphotovideo3370 Před 4 lety

    Sorry but don't save into to database, when I restart....

  • @oBaykan
    @oBaykan Před 7 lety

    Hello guys i have an error when i can try to insert a data to database.
    Error message is cannot insert explicit value for identity column in table Identity_insert is set to off
    How can i fix it?
    Thanks for your help :)

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You need to set id column is primary key and set identity. insert data you don't need add id column it's auto genereate. thanks

  • @lif0CLUB
    @lif0CLUB Před 8 lety

    Thank u

  • @jerrolmontemayor3564
    @jerrolmontemayor3564 Před 6 lety

    hello can i ask what if i want add a delete button ? what is the source code :-) .newbie here

  • @unlimitedcreativity4400

    Hi, foxlearn how can I check from a database for logining like it check if user exists and is it a right password so he could login

    • @foxlearn
      @foxlearn  Před 5 lety

      czcams.com/video/4ToxRR-zlKs/video.html .You can view this video. thank you !

  • @ranjkurdish
    @ranjkurdish Před 4 lety

    hello ,can help me after the end project how insert to other computer and working .??...thank you fox learn

    • @foxlearn
      @foxlearn  Před 4 lety +1

      You only need change your connection string in the app.config file

    • @ranjkurdish
      @ranjkurdish Před 4 lety

      Your have any vidoes About this ??

  • @johnleonhelang5220
    @johnleonhelang5220 Před 7 lety

    How can i fix "Cannot insert explicit value for identity column when set identity off" Please help

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, I think you need to set identity is true, please check your id column again, Thank you

  • @barunshah3464
    @barunshah3464 Před 7 lety

    +Fox Learn is C# and Windows C# programming same you do windows

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, C# is a programming language. With desktop application you can use C# Windows Forms. Thanks

    • @barunshah3464
      @barunshah3464 Před 7 lety

      No i know that but codes are same

    • @barunshah3464
      @barunshah3464 Před 7 lety

      i know that but the codes are same of c# windows programming and c# simple programming or not i am asking

  • @marianoamor9826
    @marianoamor9826 Před 7 lety

    If you observe the code you will see that when looking for some data you do not get what you are really looking for, but the first row of the datagrid. How can you fix that part of the code? , can you send me the code, thk

    • @foxlearn
      @foxlearn  Před 7 lety

      What's your email? thank you

    • @marianoamor9826
      @marianoamor9826 Před 7 lety

      amor-mariano@hotmail.com

    • @booney3133
      @booney3133 Před 6 lety

      I found a way with Button Click
      private void btn_Search_Click(object sender, EventArgs e)
      {
      string searchValue = txt_Search.Text;
      dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
      phoneBooksBindingSource.Filter = string.Format("{0} = '{1}'", "FullName", searchValue);
      //here you can do selection if you need
      }
      }
      }

  • @vautek
    @vautek Před 4 lety

    Hi Fox, I have tried most of the solutions from the comments in posts the closest I get is a solution for a post but it still won't save to database do you have any other ideas. once I close the form and restart the form data is gone. on this example, the only changes I am using is memberDetails instead of phoneBooks and adding appData.MemberDetails.AcceptChanges();
    private void btnSave_Click(object sender, EventArgs e)
    {
    try
    {
    Edit(false);
    memberDetailsBindingSource.EndEdit(); appData.MemberDetails.AcceptChanges(); //edited
    memberDetailsTableAdapter.Update(appData.MemberDetails);
    dataGridView.Refresh();
    txtPhoneNumber.Focus();
    MessageBox.Show("Your data has been successfully saved.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
    appData.MemberDetails.RejectChanges();
    }
    }
    Андрей И.
    1 year ago (edited)
    It's almost great video, except few bugs. BUT i can't solve a problem with SAVING data. Also, I have allready solved problem with IDENTITY - just by putting string "appData.PhoneBooks.AcceptChanges();" after "phoneBooksBindingSource.EndEdit();"
    BUT data is saving only in the Grid and don't saving in DataBase. After app restart - there are no data that I "saved".
    HELP, please!

    • @foxlearn
      @foxlearn  Před 4 lety

      You should copy your database to another folder, by default your database copy to debug folder. Each time you rebuild your project all files in debug folder will be deleted.

  • @RedRidersTerraTrips
    @RedRidersTerraTrips Před 7 lety

    Is it possible you could go trough adding delete on this ?

    • @foxlearn
      @foxlearn  Před 7 lety

      What do you mean? Can you describe more details? Thank you

  • @faiqwu9719
    @faiqwu9719 Před 7 lety

    I have follow step by step but cant save any data in my program/database pls anyone help me

  • @geoffjollygeoff379
    @geoffjollygeoff379 Před 7 lety

    hi i want to add the data inside gridview like items and subitem can you please send the code

    • @foxlearn
      @foxlearn  Před 7 lety

      OK. Thank you for your suggestion. I'll make soon

  • @gustavoxumbin6787
    @gustavoxumbin6787 Před 7 lety +1

    My search does not work, i did equals the video, has somebody with this problemas?

    • @GreenSSB
      @GreenSSB Před 7 lety

      Same, can't get it to work. Looking right now, let me know if you find something.

    • @booney3133
      @booney3133 Před 6 lety +3

      I found a way with Button Click
      private void btn_Search_Click(object sender, EventArgs e)
      {
      string searchValue = txt_Search.Text;
      dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
      phoneBooksBindingSource.Filter = string.Format("{0} = '{1}'", "FullName", searchValue);
      //here you can do selection if you need
      }
      }
      }

    • @muhammadzeyada2052
      @muhammadzeyada2052 Před 6 lety

      Thank you very much, I was struggling, you saved my life!

    • @muhammadzeyada2052
      @muhammadzeyada2052 Před 6 lety

      but how to get back the whole list again?

  • @syedjamalrizvi3464
    @syedjamalrizvi3464 Před 8 lety

    Please help me. when i click 'NEW' old record is not cleared

    • @foxlearn
      @foxlearn  Před 8 lety

      Hi, You need to add new object to bindingsource, please check your code again. thanks

  • @lxgrey07
    @lxgrey07 Před 7 lety

    what if, add open location?

  • @marto3224
    @marto3224 Před rokem

    The cancel button is unused, and the search is not working correctly in your video. Bad tutorial, in my opinion.

  • @faiqwu9719
    @faiqwu9719 Před 7 lety

    Hi this really helpful video but i always fault when tryin to save data in mu database, when i ran my program and click new it always said phonenumber cannot null and the main problem is when i have to fill all the txt and click save the database is not inserted it only show the message box "data has been successfully saved!" Please someone help me, im a newbie and really need it :(

    • @faiqwu9719
      @faiqwu9719 Před 7 lety

      +Dewi Cunny so sad to hear this happened to you, anyway i still stuck in this problem, but if you cant show the messagebox it really wierd, have you type --> MessageBox.Show("your Message","Message",MessageBoxbutton.OK,MessageBoxIcon.Information); ? If you write that line and still have error maybe the problem is with your visual studio

    • @faiqwu9719
      @faiqwu9719 Před 7 lety

      happy that you solved it, for search funciton i think the tutorial was doing right just follow this video and makesure you dont miss anything (ya sometimes is not well explained). anyway what you do to input and save your data into the database? i still stuck with this problem for a couple of months

    • @faiqwu9719
      @faiqwu9719 Před 7 lety

      that mean you make new savebutton_click method and solved your problem? where you got that code?
      thank you you are so kind :)

    • @faiqwu9719
      @faiqwu9719 Před 7 lety

      i don't know what should i do coz i also create new and follow it again again and again but the problem is the same

    • @TheGopirock
      @TheGopirock Před 7 lety

      were u able to get your data after clicking 'Save'? my data is not showing..but it says that data has been inserted successfully.

  • @vwv5555
    @vwv5555 Před 7 lety

    could you please mention more cool themes. thanks!

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You can use Metro Framework. Thanks

    • @vwv5555
      @vwv5555 Před 7 lety

      I know it and have used it, I mean if there are more themes... Thanks!!

  • @kevinhaniel2008
    @kevinhaniel2008 Před 6 lety

    My material toolbox doesn't appear

  • @ibrahemo10
    @ibrahemo10 Před 8 lety

    i got an error says "the type name AppData Does Not exist in the type name "my project name" "
    please help

    • @ibrahemo10
      @ibrahemo10 Před 8 lety

      problem solved by changing the class name into another

    • @foxlearn
      @foxlearn  Před 8 lety +1

      That's great, the AppData is name of the DataSet, you can put any name :)

  • @jeroenmulder1400
    @jeroenmulder1400 Před 7 lety

    i cant get the material single line text box how can i fix this

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You can view this video czcams.com/video/QdMXWyvKamE/video.html to know to to install and add material skin to your toolbox, then you can find single line text box in your toolbox. . Thank you

  • @user-yq5ci7yk5s
    @user-yq5ci7yk5s Před 7 lety +1

    Столкнулся с проблемой. Сделал все как описано на одной машине (Windows 7 Visual Studio 2010) - все работает. Как только перенес на другую машину (Windows XP Visual Studio 2010) сразу выдало, что невозможно вставить явное значение для столбца идентификаторов, когда IDENTITY_INSERT в положении OFF. Как быть? Куда, что или где переключить чтобы все заработало вновь?

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, I you should set id is auto number, copy to another computer your database structure don't change. please check again. thank you so much !

  • @kzhanserik
    @kzhanserik Před 7 lety

    how to add material skin controls to toolbox?

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You can view this video czcams.com/video/QdMXWyvKamE/video.html to know how to install and add material skin to your toolbox. Thank you

  • @hasanal-samarae7847
    @hasanal-samarae7847 Před 7 lety

    why arabic characters become question marks
    in the dataGridView

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, I think you should save data with nvarchar instead of varchar, Please check your datatype again. Thank you

    • @hasanal-samarae7847
      @hasanal-samarae7847 Před 7 lety

      thanks, it worked.

  • @geoffjollygeoff379
    @geoffjollygeoff379 Před 7 lety

    hi I want print option with adding logo can you please send me a source code

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, What's your email? thank you

  • @JokerZipon
    @JokerZipon Před 8 lety

    Почему сразу не сохраняет т.е. вышел из формы и информация пропала

    • @foxlearn
      @foxlearn  Před 8 lety

      What information are you missing?

    • @JokerZipon
      @JokerZipon Před 8 lety

      Запуск из Visual Studio, а не на прямую .exe При каждой компиляции сборки, данные исчезают, с чем связано ?

  • @valery_osanin
    @valery_osanin Před 7 lety

    How to use for search the button?

    • @foxlearn
      @foxlearn  Před 7 lety

      Hi, You can add a button search, then copy code even key press to button click, thanks

    • @booney3133
      @booney3133 Před 6 lety

      I found a way with Button Click
      private void btn_Search_Click(object sender, EventArgs e)
      {
      string searchValue = txt_Search.Text;
      dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
      phoneBooksBindingSource.Filter = string.Format("{0} = '{1}'", "FullName", searchValue);
      //here you can do selection if you need
      }
      }
      }

  • @ibrahemo10
    @ibrahemo10 Před 8 lety +1

    i got another error when saving the data says "cannot insert explicit value for identity column in table 'phonebooks' when IDENTITY_INSERT is set to OFF "

    • @foxlearn
      @foxlearn  Před 8 lety +2

      Hi, You need to set the identity column is auto number both table in dataset, and table in your database, please try again. thanks

    • @ibrahemo10
      @ibrahemo10 Před 8 lety +2

      +Fox Learn ok i'll give it a shot, it works by setting the identity column to false but i need it to be auto so i'll try.
      Thanks alot

    • @syedjamalrizvi3464
      @syedjamalrizvi3464 Před 8 lety +4

      I am also getting this error. Help me how i resolve it.

    • @ibrahemo10
      @ibrahemo10 Před 8 lety

      Jamal Rizvi Hi, you can resolve this problem by setting the id column identity from true to false

    • @syedjamalrizvi3464
      @syedjamalrizvi3464 Před 8 lety

      Thanks dear. Now record has been saved successfully. But when i click 'NEW' old record is not cleared

  • @SATHISHKUMARVMIS
    @SATHISHKUMARVMIS Před 6 lety

    can anyone send me this code
    ?

  • @dimaarabul8191
    @dimaarabul8191 Před 6 lety

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using MaterialSkin;
    namespace Forma
    {
    public partial class Form1 : MaterialSkin.Controls.MaterialForm
    {
    public Form1()
    {
    InitializeComponent();
    var skinManager = MaterialSkinManager.Instance;
    skinManager.AddFormToManage(this);
    skinManager.Theme = MaterialSkinManager.Themes.DARK;
    skinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500,Accent.LightBlue200,TextShade.WHITE);
    }
    private void Form1_Load(object sender, EventArgs e)
    {
    // TODO: данная строка кода позволяет загрузить данные в таблицу "appData.Sport". При необходимости она может быть перемещена или удалена.
    this.sportTableAdapter.Fill(this.appData.Sport);
    Edit(false);
    }
    private void Edit(bool value)
    {
    txtPhoneNumber.Enabled = value;
    txtFullName.Enabled = value;
    txtEmail.Enabled = value;
    txtAdress.Enabled = value;
    }
    private void btnNew_Click(object sender, EventArgs e)
    {
    try
    {
    Edit(true);
    appData.Sport.AddSportRow(appData.Sport.NewSportRow());
    sportBindingSource.MoveLast();
    txtPhoneNumber.Focus();
    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.Message, "Оповещение", MessageBoxButtons.OK, MessageBoxIcon.Error);
    appData.Sport.RejectChanges();
    }
    }
    private void btnEdit_Click(object sender, EventArgs e)
    {
    Edit(true);
    txtPhoneNumber.Focus();
    }
    private void btnCancel_Click(object sender, EventArgs e)
    {
    Edit(false);
    sportBindingSource.ResetBindings(false);
    }
    private void btnSave_Click(object sender, EventArgs e)
    {
    try
    {
    Edit(false);
    sportBindingSource.EndEdit();
    sportTableAdapter.Update(appData.Sport);
    dataGridView.Refresh();
    txtPhoneNumber.Focus();
    MessageBox.Show("Cохранить запись запись?", "Оповещение", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Оповещение", MessageBoxButtons.OK, MessageBoxIcon.Error);
    appData.Sport.RejectChanges();
    }
    }
    private void txtSeach_KeyDown(object sender, KeyEventArgs e)
    {
    if (e.KeyCode == Keys.Enter)
    {
    if (!string.IsNullOrEmpty(txtSeach.Text))
    sportBindingSource.Filter = string.Format("PhoneNumber = '{0}' OR FullName LIKE '*{1}*' OR Email ='{2}' OR Adress LIKE '*{3}*'", txtPhoneNumber.Text,txtFullName.Text,txtEmail.Text,txtAdress.Text);
    else
    sportBindingSource.Filter = string.Empty;
    }
    }
    private void dataGridView_KeyDown(object sender, KeyEventArgs e)
    {
    if (e.KeyCode == Keys.Delete)
    {
    if (MessageBox.Show("Вы Уверена что хотите удалить запись ?", "Оповещение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
    sportBindingSource.RemoveCurrent();
    }
    }
    }
    }

  • @MauricioCaterino
    @MauricioCaterino Před 7 lety

    Can you send me the code

  • @taufiqrahman2363
    @taufiqrahman2363 Před 7 lety

    Can you kindly send me the code?
    I'm stuck at one part.

  • @kaifahmed1332
    @kaifahmed1332 Před 7 lety

    please sent me too :)

  • @houriahoumel8679
    @houriahoumel8679 Před 7 lety

    could you send me source code for this project

  • @Rey_MR
    @Rey_MR Před 6 lety

    y el maldito codigo he ? esa mierda me da error

  • @anhesenatonanhesenator5219

    Здравствуйте, спасибо большое за видео! Но не могу разобраться как сделать поиск, а у вас там ошибочка ( можете пожалуйста прислать код на почту anksunamun-99@mail.ru

  • @bahaashaban2609
    @bahaashaban2609 Před 6 lety

    send me the code

  • @FilthyLemon
    @FilthyLemon Před 7 lety

    Not sure using an extremely fast, unclear AI voice was the best idea in a tutorial, and I think you could've explained what you were doing as opposed to having that AI voice giving a speedy background narration. Get's a dislike from me.

    • @foxlearn
      @foxlearn  Před 7 lety

      Thank you for your suggestion, I'll try to better :(

  • @mohammadaziz150
    @mohammadaziz150 Před 7 lety

    u very eng ,send me code
    plaes

    • @foxlearn
      @foxlearn  Před 7 lety

      Sent, Please check your email. Thank you

    • @mohammadaziz150
      @mohammadaziz150 Před 7 lety

      Fox Learn alabadan.market@gmail.com

  • @buffaloSoldier519
    @buffaloSoldier519 Před 8 lety

    Won't let me add a reference to the material's toolbox

    • @foxlearn
      @foxlearn  Před 8 lety

      Hi, You can view this video: czcams.com/video/QdMXWyvKamE/video.html, thanks