本文介绍了如何从零开始创建数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在创建一个应该处理联系人,订单等的应用程序。 我只想分发exe文件并让应用程序花费 来创建并且更改要使用的数据库。 此外,我还想让用户可以选择要创建和使用哪种数据库, MSSQL,Oracel,Access 等 这可能吗?或者我也分发了数据库文件?我的第一个想法是使用OLEDB并让用户选择使用哪个提供商,但是我没有有效的数据库就无法打开数据库连接 文件。 与此类似的东西.. 假设字符串aConnectionString等于 " Provider = Microsoft.Jet.OLEDB.4.0; Data Source = \ somepath \ mydb.mdb; User Id = admin; Password =;" 或Provider = sqloledb; Data Source = Aron1; Initial Catalog = pubs; Integrated Security = SSPI;" 或Provider = MySQLProv; Data Source = mydb; User Id = UserName; Password = asdasd;" OleDbConnection oConnection = new OleDbConnection(aConnectionString); OleDbCommand oCommand = new OleDbCommand(" create database aDbName",oConnection); oConnection.Open(); oCommand。 ExecuteNonQuery(); oConnection.Close(); Br Jon asI''m creating a application that should handle contacts, orders etc.I want to distribute only the exe file and let the application takecare of creating and changing the database that is to be used.Furthermore, I would also like to make it possible for the user toselect which sort of database to create and use, MSSQL, Oracel, Accessetc.Is this possible? Or do I have distribute a databas file as well? Myfirst idea was to use OLEDB and let the user select which provider touse, but I can''t open a databas connection without a valid databasefile.Something simular to this..Assume that the string aConnectionString would equal"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;UserId=admin;Password=;"or "Provider=sqloledb;Data Source=Aron1;InitialCatalog=pubs;Integrated Security=SSPI;"or "Provider=MySQLProv;Data Source=mydb;UserId=UserName;Password=asdasd;"OleDbConnection oConnection = new OleDbConnection(aConnectionString);OleDbCommand oCommand = new OleDbCommand("create databaseaDbName",oConnection);oConnection.Open();oCommand.ExecuteNonQuery();oConnection.Close();BrJonas推荐答案 这篇关于如何从零开始创建数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-01 17:33