How to Connect SQL Server with Visual Studio 2022 and Run SQL Queries

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to my Channel today in this video tutorial we are going to learn about connecting to his cable server in visual studio 2010-22 and we will create a database and database tables as well as we will run queries from here into our cable server so if you have not uh if you are not seeing the server Explorer window now you can go to this View and click on this server Explorer now it will appear if you click on this uh connect to database now it will show you a dialog like this but if it does not appear it means that you do not have a cable server support and visual studio it will automatically show you a dial dialog to install there and uh when you click yes so it will download it from the official setup uh his cable up visual studio and it will add it into your visual studio now here you need a server name so when you have a local installation you can the refer to server name by three ways either you write here localhost and now if I come here to this database tab now you will see our databases or here now uh the second method is to put a dot here now you can see that we have a DOT here our databases appear again so dot also refer to local installation and you can go to your ssms and copy your fully qualified server name from here copy this and you can go here to visual studio and paste it here now I do not want to select a database here we will create a database later so I'll click ok now you can see that we are connected to our master dbo so if I right click on this and you can see it's uh you can delete this you can change view you can modify Connection close connection new query and you can uh browse in uh SQL Server Explorer and you can rename this and you can check its properties as well now if you want to create a new database so you can right click on this and create new cable server database so you can click on this and I will name this uh we will put our server name this here so I'll Ctrl V8 here as I already copied it now I'll give the data base name here demo DB and now I'll click ok to create this database now you can see that demo DB is created now if I explore this now you can see tables inside this video store procedure functions synonyms types and assemblies all we have in our SQL Server management Studio we have here as well now if you have this you do not need to install SQL Server management studio now if I right click on this I'll add a new table now it is given us this uh designer as well as uh this query so you can create the table through query as well as through designer now it automatically takes this ID as a primary key and it automatically generate this now we will add in a few columns so I'll add a name and I will uh make its uh and Watcher 50 and similarly I will add F name and I'll make this uh and work or 50 and now we will come here and I will Auto increment and make this identity n how to increment so I'll use identity and here I'll use one comma 1 and now I'll close this now to create this uh uh table we have created the table you can change the name of this table from here so I'll name this uh STD underscore table and uh or I will name this uh demo underscore table now this is our table now you have to execute this to execute for execution of this you come to this update click on this update and then you press update database now it is saying here that update for desktop is updated complete successfully so it means our update is completed now if I refresh this and if I go to this tables and I right click on this and refresh this now you can see the table here now if I right click on this and if I go to this show data so you can see here we do not have any data here so now I'll add in some data here so I'll add mik and on and similarly I will add a Ali and Ahmad and then I will add in tanvir and I'll add gold now I've added this now our data is added into this so I'll control this it uh and now we will show the data are inaccurity so I'll right click on here on this and new query so now here we will select static from demo table this one and now if I execute this now you can see it shown as this these two rows we have added these two rows now we have added three but it has shown us these two if I go here we haven't pressed a tab to create a value or an ID and save this data now it is saved now if I execute this again now you can see three records are shown here so in this way we can run queries from here now you can also delete the data from the designer if I go here and I'll show data this and now if I right click on this last record and if I go to delete and yes and now you can see the record is deleted now if I refresh this now you can see only two records now if I go to this is cable and now if I execute this now you can see only two records so in this way you can the connect to uh Escape in server and viewer visual studio and you can run all the commands you can do this in a project as well so you do not have to switch between ssms and visual studio you can do all your jobs here so I think that's all for today I hope you like the video if you like the video please like subscribe and comment thank you
Info
Channel: Programming Guru
Views: 12,974
Rating: undefined out of 5
Keywords: Connect to SQL Server Using Visual Studio 2022 and Run SQL Queries (Create Read Update Delete), sql server 2019, sql server, visual studio, visual studio 2022, crud in sql server using visual studio, sql server and visual studio, connect to sql server in visual studio 2022, sql, queries, crud, crud in sql sever, crud in visual studio, Run sql queries in visual studio 2022, Create Read Update Delete, sql sever using visual studio, crud visual studio, Run sql server in visual studio
Id: rNgcVqbBgYA
Channel Id: undefined
Length: 8min 9sec (489 seconds)
Published: Thu Oct 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.