none
How to Create and use a Database in visual studio 2019 RRS feed

  • Question

  • I want to create a new database to an new project for test purposes before i add one to my main project just to make sure that i don't mess something.

    I was found some tutorials (with pictures) but all those tutorials are for older versions of visual basic and i can't make anything work.

    Is there any tutorial for visual studio 2019 that will help me start to use a database? (with pictures if possible) and some sample code on how to use?


    • Edited by antonisq Wednesday, August 14, 2019 9:54 AM
    Wednesday, August 14, 2019 9:51 AM

Answers

  • You have done a lot of work, that is great. The problem is  i don't have an office license so i don't have access, that mean that i must stay with the database that are inside visual studio? 

    Is the code that you use in your post the same as a visual studio database. (I apologize i don't know what types of databases are exist and i hope that this make sense) I use something that is called Database1.mdf


    After that i add a table and i input all the field that i need. But i can't find any other tutorial for visual studio 2019 on how to use.


    Since you don't have a licence then use SQL-Server as per below.

    https://docs.microsoft.com/en-us/visualstudio/data-tools/create-a-sql-database-by-using-a-designer?view=vs-2019


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by antonisq Wednesday, August 14, 2019 11:32 AM
    Wednesday, August 14, 2019 10:46 AM
    Moderator

All replies

  • What type of database? 

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 14, 2019 9:53 AM
    Moderator
  • I am not familiar with databases so my idea is to have database with a table where i can store some data, in my case: Location, temperature, humidity and so on) 
    Wednesday, August 14, 2019 9:56 AM
  • Okay, it sounds like it doesn't matter which database then.

    In that case use MS-Access by creating the database using MS-Access then place the database into the bin\debug folder. It's not the effort to dynamically create a database at runtime (meaning using code) as doing so requires that the user (if this app is for others) has specific DLL files and if on your machine all this does is prove to yourself you can create a database at runtime.

    Since this is your first encounter with databases I would be more concerned with learning how to work with an existing database. I have a series on this in three parts, all have source code.

    https://social.technet.microsoft.com/wiki/contents/articles/52452.ms-access-with-vb-net-best-practices-part-1.aspx

    https://github.com/karenpayneoregon/WorkingWithAccessDatabases


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 14, 2019 10:09 AM
    Moderator
  • You have done a lot of work, that is great. The problem is  i don't have an office license so i don't have access, that mean that i must stay with the database that are inside visual studio? 

    Is the code that you use in your post the same as a visual studio database. (I apologize i don't know what types of databases are exist and i hope that this make sense) I use something that is called Database1.mdf


    After that i add a table and i input all the field that i need. But i can't find any other tutorial for visual studio 2019 on how to use.


    • Edited by antonisq Wednesday, August 14, 2019 10:37 AM
    Wednesday, August 14, 2019 10:20 AM
  • You have done a lot of work, that is great. The problem is  i don't have an office license so i don't have access, that mean that i must stay with the database that are inside visual studio? 

    Is the code that you use in your post the same as a visual studio database. (I apologize i don't know what types of databases are exist and i hope that this make sense) I use something that is called Database1.mdf


    After that i add a table and i input all the field that i need. But i can't find any other tutorial for visual studio 2019 on how to use.


    Since you don't have a licence then use SQL-Server as per below.

    https://docs.microsoft.com/en-us/visualstudio/data-tools/create-a-sql-database-by-using-a-designer?view=vs-2019


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by antonisq Wednesday, August 14, 2019 11:32 AM
    Wednesday, August 14, 2019 10:46 AM
    Moderator
  •  I appreciate your help. I will experiment with this. By the way i love your car (twitter follower :-)  )

    Wednesday, August 14, 2019 11:32 AM
  •  I appreciate your help. I will experiment with this. By the way i love your car (twitter follower :-)  )

    Your very welcome. 

    BTW I have two of those cars :-)


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 14, 2019 12:19 PM
    Moderator