Тёмный

C# Tutorial - How to Connect and Use Local Database in Visual Studio 2019 | FoxLearn 

Fox Learn
Подписаться 95 тыс.
Просмотров 379 тыс.
50% 1

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 141   
@chrysanthemum9484
@chrysanthemum9484 3 года назад
Good Lord thank you. This answered like a third of the questions I had about the use of database in VS2019.
@borisndong6747
@borisndong6747 3 года назад
He made it so simple and easy to understand ...
@foxlearn
@foxlearn 3 года назад
Thank you !
@LeeKobe1
@LeeKobe1 Год назад
Excellent tutorial! Many of us who followed these steps, and then ran the form, could not save the data inspite of clicking on the Save icon. Thoughts? I do have one other question...I have included a line in the table with 'image' selected as type of input. I'd like to upload an image on that line and into the form/app. Can you point me in the right direction? Thank you! (Bonus question: during the video, just after dragging the dataset to the form, it shows a quick move (step) in making the ID field disappear. It was so quick that even after rewinding several times, I couldn't catch the step. Can anyone shed some light on that?) Thanks.
@kevinfredrick2268
@kevinfredrick2268 3 года назад
Thanks but this actually doesn't store the data in the actual database. It only saves the data in the dataset temporarily. So, after closing the application, the data will be deleted and cannot be found in the database. A piece of code is missing in order to physically store the data into the database.
@zendpro61
@zendpro61 3 года назад
can you learn me how i can store data in database ?
@ahmoodk
@ahmoodk 2 года назад
What code do you need for it to permanently save?
@tomhrcze
@tomhrcze 2 года назад
@@zendpro61 lkln
@zendpro61
@zendpro61 2 года назад
@@tomhrcze you know how ?
@osanbrazil999
@osanbrazil999 Год назад
There's no code missing. Because you are running the program on the original folder, the data in the debug folder is deleted when u run (compile) the app again. Just copy the contents of the debug folder to another folder, e.g. "c:\myapps" and the table data will not be lost after you click on save button. When u run the program again, they'll be there.
@AKMROBLEH
@AKMROBLEH 10 месяцев назад
Excellent tutorial! Many of us who followed these steps, and then ran the form, could not save the data inspite of clicking on the Save icon. Thoughts? I do have one other question...I have included a line in the table with 'image' selected as type of input. I'd like to upload an image on that line and into the form/app. Can you point me in the right direction? Thank you! (Bonus
@matthewalexander565
@matthewalexander565 2 года назад
God bless this tutor so much abegggg. This was sooo sooo helpful
@dimplekhurd0126
@dimplekhurd0126 10 месяцев назад
Last min revision...Thanks a lot mam
@ybmprod4141
@ybmprod4141 4 месяца назад
It's fast But one of best Tut so far Thank U❤️
@xyrusdos3008
@xyrusdos3008 3 года назад
THANK U SO MUCH YOU SAVED ME FOR GETTING A 75 GRADE!!
@Predo1064
@Predo1064 4 года назад
Great video, thank you. I do have a problem though and would be very grateful for any help. When I run the data configuration wizard, after I have selected the table and click finish I keep getting an error. Could not find file dbo.Purchase, Purchase being the table name.
@ehsanabbasi9405
@ehsanabbasi9405 2 года назад
hello ! I've created a database project like this. It works well on my computer but when I move debuged folder on another computer it doesn't work well. What Prerequisites needed to be install on that computer to run sql base projects. Thank you
@davidcerino1145
@davidcerino1145 Год назад
I don't know if you got an answer for this already, but I think you might need to make an installer, and then install that on the other machine to work. I just happen to see that on another video right before this one called "Build & Deploy C# Application And run it on any machine"
@black_sauce2478
@black_sauce2478 Год назад
This is not a Local Database, this database requires SQL server service. So you still need to install SQL server.
@delta4135
@delta4135 2 года назад
*If someone can't find Data Sources:* In my case it was in View > Other windows > Data Sources
@utsavgohel9485
@utsavgohel9485 2 года назад
thanku brother in this video i have cleared my database doutss
@mypettaco
@mypettaco 4 года назад
Hello. First, thanks for the video it saved me a lot of work/research. I'm having a separate issue that I think you might be able to help me with. I have two solutions, one similar to this that edits a database (for testing purposes), and another which is reading the database and doing stuff with the data. What I want to do is deploy these two projects together, so if anyone clones the repo they have full functionality. For my other project, I have manually configured the connection string to read the database from the executing folder and that solution copies the database to the executing folder. So I maintain a "virgin" copy of the db in the original location, and then edit the one in the runtime folder. I've included the same db in the db editing program. However, when I compile it, it connects to the "virgin" db as I can see that is where the connection string is pointing. I've played around with the connection string and keep getting an error "An attempt to attach an auto-named database for file ... failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share." I'm hoping you can tell me how to get it to point to the db in the runtime directory, rather than the original one. Thanks!
@spiritretro3571
@spiritretro3571 6 месяцев назад
i have an issue: i created a setup project to "install"the program (changed to release mdoe), and when i launch the installed program it says it either cannot connect to the db or a db with the same name already exists, whats going on?
@mohamadrezaghadami1238
@mohamadrezaghadami1238 4 года назад
the most helpful one ! thank you so much
@hansen_docked_in
@hansen_docked_in 4 года назад
Hi! Great video. However I have one question: I followed your steps but my first input is not shown. Second row is fine and so on (so ID 2 is in row2/first row beneath header row). Any idea why? And how can I save the data to the table after closing the (compiled) program and also load data when opening it?
@YoungvLondon
@YoungvLondon 4 года назад
I'm having the same issue. Seems no matter what data is in the fields, that first entry returns everything but the index as null values.
@hazielv.kapustin6138
@hazielv.kapustin6138 3 года назад
Did you solve it? :c
@Jenil_Ramani
@Jenil_Ramani 2 года назад
Click on save button when you run.
@osanbrazil999
@osanbrazil999 Год назад
Because you are running the program on the original folder, the data in the debug folder is deleted when u run (compile) the app again. Just copy the contents of the debug folder to another folder, e.g. "c:\myapps" and the table data will not be lost after you click on save button. When u run the program again, they'll be there.
@LeeKobe1
@LeeKobe1 Год назад
@@osanbrazil999 Thanks. Many of us who followed these steps, and then ran the form, could not save the data inspite of clicking on the Save icon. I'll give your suggestion a try. I do have one other question...I have included line in the table with 'image' selected as type of input. I'd like to upload an image on that line and into the form/app. Can you point me in the right direction? Thank you!
@lgoony9909
@lgoony9909 2 года назад
Does anyone knows how to change the gender using an edit button?
@incognito5580
@incognito5580 2 года назад
is it possible to migrate ms access database to the cloud and still be able to connect using c#?
@HeapKhim
@HeapKhim 4 года назад
Very good, worked. Thank you!
@horizon8565
@horizon8565 2 месяца назад
Thank you very much
@diegobuenano5833
@diegobuenano5833 5 лет назад
Great video 😁 I have a little question. Years ago you made a video to send whatsapp messages from c#, could you update it? Or there is not posible to send messages like that anymore
@foxlearn
@foxlearn 5 лет назад
OK. Let me try to research and update
@zamrinjameel3305
@zamrinjameel3305 5 лет назад
can we prevent data lose on rebuilding the project while using this db method?
@foxlearn
@foxlearn 5 лет назад
Copy your database to another folder, then modify your connection string
@swerytv4342
@swerytv4342 5 лет назад
Hi fox learn in fact I need a tutorial on how to create a login and authorization system with different selectable roles via Treelist based on my Devexpress ribbon menu. Thank you.
@mamadoouboboaissatoudiallo9725
Well excellente suggestion i need that tutotial toi dear fox Learn
@foxlearn
@foxlearn 5 лет назад
OK. Thank you for your suggestion. I'll upload soon !
@Areeven
@Areeven 10 месяцев назад
Awesome! Easy to follow =D
@jimmyjobindi2128
@jimmyjobindi2128 3 года назад
Excellent video. Thanks a ton.
@kentabillon9951
@kentabillon9951 4 года назад
This error shows when I try to save an item Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
@arthansen9297
@arthansen9297 3 года назад
Incredibly useful - thank you.
@foxlearn
@foxlearn 3 года назад
Glad it was helpful! thank you !
@challenger7540
@challenger7540 5 лет назад
hello thanks for the video. in some vdeos there are both (local database option and service based option) in their visual studio ...but in my visual studio 2013 there is only service based database just like in this video..is there any difference and why i cant see localdb option ?
@foxlearn
@foxlearn 5 лет назад
The same, sql database connect to sql express is local. and attach to sql server, then connect to sql server is sql service. i think so
@challenger7540
@challenger7540 5 лет назад
@@foxlearn thanks
@subhamghosh-007
@subhamghosh-007 5 лет назад
I have one question I have to create an database application for offline data entry for my client, So can I use this method? So do I need to install sql in my cluent pc or just provide him project setup?
@foxlearn
@foxlearn 5 лет назад
Yes, you can do the same for sql
@89Ssik
@89Ssik 2 года назад
When I put FullName, Email, Phone, Gender, Adress for first user it doesn't appear, it starts appearing only from second user, someone know solution? Also Gender in Gridview is just showing check ON/ OFF its not right solution, as you can see in 9:07minutes.
@foxynight1688
@foxynight1688 2 года назад
thank you for this video !! it easy to understand and make me clearly to do it>>>>
@rzeezed757
@rzeezed757 3 года назад
Is there a way to save the database even when you close the program?
@ahmoodk
@ahmoodk 2 года назад
did you find out how to do that
@MusakaGamer
@MusakaGamer 4 года назад
If i copy this program to another computer will i have saved database ?
@andrewdarrensmith1
@andrewdarrensmith1 3 года назад
Nothing displays in the grid view. How can i fix this?
@chamodkavinda7291
@chamodkavinda7291 3 года назад
Thanks a lot.
@nathancrawley5212
@nathancrawley5212 4 года назад
oh my gosh I needed this soo much
@foxlearn
@foxlearn 4 года назад
Thank you !
@cuadraramonvincent8043
@cuadraramonvincent8043 3 года назад
do you have this for 2012 version of visual studio
@georgihristov2553
@georgihristov2553 2 года назад
PLS HELP i do everything in this video but now i want to add search button to this code pls help me
@AFM_Champions_Tabernacle
@AFM_Champions_Tabernacle 2 года назад
This is fantastic
@christinemarioneilogon6089
@christinemarioneilogon6089 2 года назад
do i need internet to access this type of database?
@selmirmuminovic551
@selmirmuminovic551 2 года назад
How to add buttons one by one for save, delete, add, and same design like there?
@bengali.318
@bengali.318 4 месяца назад
hey same problem with me, were you able to find a solution?
@pratibhatechnology7613
@pratibhatechnology7613 4 года назад
according to i create a form and insert value data and show in same form gridview but when i check in folder data not show
@foxlearn
@foxlearn 4 года назад
You should copy data to another folder
@lingeshwarankuppusamy947
@lingeshwarankuppusamy947 3 года назад
Hai please update a video to select multiple database by using combobox method in C# along with with external data base exe setup. I will be very help full for beginners.
@foxlearn
@foxlearn 3 года назад
OK. Thank you for your suggestion. I'll upload soon !
@bengali.318
@bengali.318 4 месяца назад
hey , i dont have the add new, cancel, save button on top after running the program, what should i do?
@dacracking5768
@dacracking5768 3 года назад
OMG. IT WAS THAT EASY!!! FML
@foxlearn
@foxlearn 3 года назад
Thank you !
@haydar8545
@haydar8545 4 года назад
Hi fox learn Thanks for all videos, i need help : how to create master details application and insert data into master table and datails table in c#
@deiost
@deiost 5 лет назад
Very good video, but ModelDataSet contents shown on 3:50 not moving for me so easy with mouse
@deiost
@deiost 5 лет назад
Solved: Had to put VS window back from external monitor on laptop, and everything works perfect
@foxlearn
@foxlearn 5 лет назад
Thank you !
@myself8709
@myself8709 2 года назад
Thnku
@michelleestrellanes4352
@michelleestrellanes4352 3 года назад
Is this only for one pc? How can it connect to other PC's? Thank you
@foxlearn
@foxlearn 3 года назад
Only one pc, if you want to multiple connection you should install sql server, then the clients can connect to sql server
@ahmoodk
@ahmoodk 2 года назад
@@foxlearn how do you do that?
@Guilherme.robo.python
@Guilherme.robo.python Год назад
thanks
@medamine6695
@medamine6695 3 года назад
Even after all there years I still can't remember where I heard this ost you are using XD
@foxlearn
@foxlearn 3 года назад
Thank you !
@zulfifarsath
@zulfifarsath 4 месяца назад
can you please do money lending project in visual studio C#
@younoushissene9741
@younoushissene9741 2 года назад
This is fri good
@davisantos5672
@davisantos5672 2 года назад
Omg! Thanks
@ikramanjum3722
@ikramanjum3722 3 года назад
excellent
@e.h.sojibmia5118
@e.h.sojibmia5118 4 года назад
Nc video 😍😍😍😍 🇧🇩🇧🇩🇧🇩🇧🇩
@bojidarkamenski3432
@bojidarkamenski3432 5 лет назад
Nice video thank you!!! Can I ask if someone of you know how to solve this problem I am using ssms 2017 express server on my application it is working properly on my pc but when I am using another pc (aka client machine) it doesn't working - error 26. It is not important I am student who is creating something like school project. I researched in stack or github but no result. Thank you again for this video!
@foxlearn
@foxlearn 5 лет назад
You should install sql express on client machine
@bojidarkamenski3432
@bojidarkamenski3432 5 лет назад
@@foxlearn ok thank you
@freezersharp
@freezersharp Год назад
The most important part is missing: how can I create that mdf file?
@YAMahaboob
@YAMahaboob 3 года назад
i can't create new table ... why ?
@bonaoberwinb.9673
@bonaoberwinb.9673 3 года назад
Is the procedure the same in asp net?
@foxlearn
@foxlearn 3 года назад
Yes
@usssr1917
@usssr1917 3 года назад
data binding does work WTF
@deekshasinghchauhan8133
@deekshasinghchauhan8133 5 лет назад
Hello, can you tell me How to add reference of microsoft.offic in 2019
@foxlearn
@foxlearn 5 лет назад
Right click on your project, then select reference. Next, find the Microsoft.Office..
@bestdynamicfitness
@bestdynamicfitness 5 лет назад
how to do auto increment start 1 entity framework? edmx diagram
@foxlearn
@foxlearn 5 лет назад
You can set to the table in your database
@bestdynamicfitness
@bestdynamicfitness 5 лет назад
@@foxlearn can you send tut?
@whoman0385
@whoman0385 2 года назад
ok. now how do I host the database on a server :gun:
@dlmredii
@dlmredii Год назад
How to insert photos
@shahzaibshahzaib1514
@shahzaibshahzaib1514 3 года назад
is Local DB require Sql Server installation on client machine? Thanks:)
@foxlearn
@foxlearn 3 года назад
Yes, you should install sql express
@Esp1fs
@Esp1fs 5 лет назад
How you publish that app with database?
@foxlearn
@foxlearn 5 лет назад
OK. Thank you for your suggestion. I'll upload soon !
@aldinbeganovic8323
@aldinbeganovic8323 Год назад
working bro! Thanks a lot, +sub +like
@jmdeluxe
@jmdeluxe 4 года назад
cant find my data sources
@jmdeluxe
@jmdeluxe 4 года назад
@@radenazhar3112 nooe but try reinstalling everything
@radenazhar3112
@radenazhar3112 4 года назад
@@jmdeluxe does it work bro?
@jmdeluxe
@jmdeluxe 4 года назад
@@radenazhar3112 yee i have freash laptop and I did my installing in there everything work in my laptop but not on oc
@MagicGladiatorMandrake
@MagicGladiatorMandrake 4 года назад
This kind of Tutorials began in 2005. it's very old trick. we need the connection code not wizard..
@muhammadbilal6865
@muhammadbilal6865 3 года назад
Whats wrong if something can be done in an easy way why you want to hide the things software enginner bro.
@laptrinhwindowsform
@laptrinhwindowsform 5 лет назад
Please guide xamarin form c # topic, thanks
@foxlearn
@foxlearn 5 лет назад
OK. Thank you for your suggestion !
@adeel3797
@adeel3797 4 года назад
Music name?
@alirezaabedi1885
@alirezaabedi1885 5 лет назад
like
@foxlearn
@foxlearn 5 лет назад
Thank you !
@ramzimadene8607
@ramzimadene8607 3 года назад
im a zhee
@foxlearn
@foxlearn 3 года назад
Thank
@cyprianskrzypczak1971
@cyprianskrzypczak1971 3 года назад
Nowdays gender needs to be stored as a bigint
@Kaspar-j3g
@Kaspar-j3g 11 месяцев назад
The "gender = bit" is a hot take in today's reality lol
@lelouchlamperouge5910
@lelouchlamperouge5910 3 года назад
This don't save any data, useless, a waste of time.
@nephytv
@nephytv 2 года назад
wayy to fast lmao
@Mibaka
@Mibaka Год назад
simple way for connection using MySql.Data.MySqlClient; using System.Data.SqlClient; 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; namespace mudi_13_10_databse_trainings { public partial class Form1 : Form { SqlConnection con = new SqlConnection(@"Data Source = LAPTOP-2A5CNVC3\SQLEXPRESS; Initial Catalog = Countries; Integrated Security = True"); SqlCommand cmd = new SqlCommand(); public Form1() { InitializeComponent(); } private void btnClear_Click(object sender, EventArgs e) { dgvShowData.DataSource = null; } private void btnExit_Click_1(object sender, EventArgs e) { Application.Exit(); } private void btnShow_Click_1(object sender, EventArgs e) { try { con.Open(); cmd = new SqlCommand("Select * from Coutnry", con); cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dtable = new DataTable(); da.Fill(dtable); dgvShowData.DataSource = dtable; con.Close(); } catch { MessageBox.Show("Error 404"); } } private void dgvShowData_CellContentClick(object sender, DataGridViewCellEventArgs e) { } } }
@kaveeshaperera6295
@kaveeshaperera6295 Год назад
Thanks a lot
@melodicmonster
@melodicmonster Год назад
It is good this is not a tutorial on good database or UI design because both are atrocious in the video.
@C0rndawg
@C0rndawg Год назад
I'm subcrubesd. Ncie videos.
@karlatwork688
@karlatwork688 5 лет назад
Another excellent video. Thanks and keep up the quality work.
@foxlearn
@foxlearn 5 лет назад
Thank you so much !
@Fkn1405
@Fkn1405 4 года назад
Hi there, when i run my project, the local database loses connection which makes impossible to save data from the form to the DB. Do you guys have an idea on how to solve that issue?
@dr.kenhurt9832
@dr.kenhurt9832 4 года назад
you mean the icon gets a little red cross in its corner? If that it does not mean that the database loses connection. If you look in your project folder there are several databases. The one in the root gets copied to the bin/debug folder everytime you run the project in Visual studio. When you stop running the project that database gets to the state it was before runnig. Try running the exe file in bin/debug filder. It will affect the database in that folder and all the changes must get applied
@Fkn1405
@Fkn1405 4 года назад
@@dr.kenhurt9832 ,Thanks!
Далее
Самая сложная маска…
00:32
Просмотров 747 тыс.
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Просмотров 1,6 млн
Свожу все свои тату (abricoss_a_tyt)
00:35
Как он понял?
00:13
Просмотров 108 тыс.
Creating Database using Visual Studio
7:57
Просмотров 281 тыс.
Самая сложная маска…
00:32
Просмотров 747 тыс.