简体   繁体   中英

In VS 2012 Express, do I need to use a database connection or is it all built in?

I have Visual Studio Express 2012. I took VB program classes in high school and college, but it's been a while. We never messed with databases in class and I always really wanted to.

I've recently downloaded the VS Express 2012 and discovered that it now has built in functions to create a database, dataset, adapters, etc...

I still don't have a super clear grasp on how it all works, but as I understand it, you have your forms and your database. You fill a dataset with information from the database, so that you can manipulate it without leaving a connection to the database open. You do what you want to it, including: modify, add, delete, display on form, etc... Then when you're done, if you've made changes, you commit them to the database.

An article I was reading last night was telling me most of that. It was talking about making a connection string, running some SQL code, then ending the connection till you need it again.

My question is, do you need to create a connection string in the code with VS Express 2012 or can you do everything you'd need to with the database, just using the tools that VS Express 2012 provides you, like the dataset, data adapter, etc... Thanks.

yes,you will need to add connection string in your code somewhere or you can add it in your web.config file such as

 <connectionstring> 
<add name="ConnectionStringName" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"/>
</connectionstring>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM