ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs
Revision: 85
Committed: Fri Jul 13 21:10:26 2012 UTC (11 years, 2 months ago) by william
File size: 1156 byte(s)
Log Message:
+ add support for database access from:
* SQL Server Express
* SQL Server (not Express)
* SQL Server MDF file

File Contents

# User Rev Content
1 william 85 using System;
2     using System.Collections.Generic;
3     using System.Text;
4     using System.Data.SqlClient;
5    
6     namespace AnywhereTS.DBSupport
7     {
8     public class SqlMdfConnector : DBConnector<SqlParameter, SqlCommand, SqlConnection, SqlDataAdapter>
9     {
10     public SqlMdfConnector(string DBServerAddress, string DBServerInstance, string SqlMdf) : base(DBServerAddress, DBServerInstance, SqlMdf) { }
11    
12     public override void CreateConnection(out Exception ErrorInfo)
13     {
14     ErrorInfo = null;
15     try
16     {
17     string connetionString = null;
18     connetionString = string.Format(@"Data Source={0}\{1};;AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase);
19     connection = new SqlConnection();
20     connection.ConnectionString = connetionString;
21     }
22     //catch (SqlException ex) { Console.WriteLine(ex.ToString()); ErrorInfo = ex; throw ErrorInfo;}
23     catch (Exception ex) { Console.WriteLine(ex.ToString()); ErrorInfo = ex; throw ErrorInfo; }
24     }
25     }
26     }