Usage of database connection words in web.config

xiaoxiao2021-03-06  63

2003-01-15 09:37:32

In the setting of the web program in ASP.NET, we must use Web.config to store database connection words. In fact, this is a good practice, because you can save us a lot of troubles can also help us avoid unnecessary misplaced Yes, I will do this. It records this information through XML. The specific is to record in .... this tag. Please see an Oracle example below: , in your application, you only Write, you can, as follows: string conn = configurationSettings.appsettings ["OracleConnectionstring"]; OLEDBCONNECTION MyConnection = New OLEDBCONNECTION (CONN); is it easy to entertaine? Don't entertain each time you hate Information, just need a good name, you can. Well, I am here to give other connection words mysql connection words: connectionString = " " Database = mysqldatabase; " "User id = myusername;" "password = mypassword;" "Command Logging = false"; OLE DB of: IBM AS / 400 OLE DB of 'VB.NETDim oOleDbConnection As OleDb.OleDbConnectionDim sConnString As String = _ "Provider = IBMDA400.DataSource.1;" & _ "Data source = myAS400DbName; "& _" User ID = myusername; "& _" password = mypassword "ooledbconnection = new oledb.oledbconnection (sconnstring) oledbconnection.open () Jet OLE DB '

Vb.netdim ooledbconnection as oledb.oledbconnectiondim sconnstring as string = _ "provider = microsoft.jet.Oledb.4.0;" & _ "data source = c: /mypath/myjet.mdb;" & _ "user id = admin;" & _ "Password =" oOleDbConnection = New OleDb.OleDbConnection (sConnString) oOleDbConnection.Open () Oracle OLE DB of 'VB.NETDim oOleDbConnection As OleDb.OleDbConnectionDim sConnString As String = _ "Provider = OraOLEDB.Oracle;" & _ "Data Source = MyOracleDB; "& _" User ID = myUsername; "& _" 'VB.NETDim Password = myPassword "oOleDbConnection = New OleDb.OleDbConnection (sConnString) oOleDbConnection.Open () SQL Server OLE DB of oOleDbConnection As OleDb.OleDbConnectionDim sConnString As String = _ "Provider = sqloledb;" & _ "Data Source = myServerName;" & _ "Initial Catalog = myDatabaseName;" & _ "User Id = myUsername;" & _ "Password = myPassword" oOleDbConnection = New OleDb.OleDbConnection (sconnstring) ooledbconnection.open () SYBA 'VB.NETDim se ASE OLE DB of oOleDbConnection As OleDb.OleDbConnectionDim sConnString As String = _ "Provider = Sybase ASE OLE DB Provider;" & _ "Data Source = MyDataSourceName;" & _ "Server Name = MyServerName;" & _ " Database = MyDatabaseName; "& _" User ID = myusername; "& _" password = mypassword "ooledbconnection =

转载请注明原文地址:https://www.9cbs.com/read-119467.html

New Post(0)