-
Sep 21st, 2020, 01:40 AM
#1
Thread Starter
Fanatic Member
How to connect to SQL Server data without using SQL Server Management Studio in .Net?
ask: is it possible to connect SQL Server data according to file connection type, just like in microsoft access data connection
public static string sConnectionString = @ "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + @ "| DataDirectory | \ data.mdb" + "; Persist Security Info = False; Jet OLEDB: Database Password = 123";
How do you convert the above access connection into sql server connection ?
-
Sep 21st, 2020, 02:18 AM
#2
Re: How to connect to SQL Server data without using SQL Server Management Studio in .
You don't. Management Studio is completely irrelevant regardless. It's an application in itself. Applications, SSMS included, connect to a SQL Server instance. Management Studio is not the instance. It's just a tool for managing the instance, but that can be done in various other ways too.
SQL Server is, as the name suggests, a server-based database. Without the server, there is no database. MDB data filescan work because the Jet database engine is effectively built into Windows. If you use an ACCDB file, you still need to install the ACE engine. The SQLite database engine is a DLL or two that you deploy with your app, so there's no separate installation. SQL Server requires a separate installation.
You can deploy an MDF data file with your app, like you would an MDB file, and have it attached to a SQL Server instance automatically on demand, but SQL Server Express needs to be installed on the same machine as the application for that to work. In that case, instead of using Initial Catalog in the connection string to specify an attached database, you use AttachDbFilename and specify the path of the data file. That also supports the |DataDirectory| placeholder. It's very easy to find information about SQL Server connection strings online. The first port of call should be https://www.connectionstrings.com/.
-
Sep 23rd, 2020, 09:21 PM
#3
Thread Starter
Fanatic Member
Re: How to connect to SQL Server data without using SQL Server Management Studio in .
I have made a small example of SQL Server data.mdf file connection, but when successfully connected, this file is automatically inserted into SQL Server Management Studio, I have an example of another company providing database file connection. SQL Server but after connecting to SQL Server database, this data file does not enter SQL Server Management Studio, I am trying to find out why the connection does not put database into SQL Server Management Studio, this is the database file connection string. mine:
Code:
public static string sConnectionString = @"Data Source = Computer; AttachDbFileName=|DataDirectory|\data.mdf; InitialCatalog = Data;Integrated Security = True; MultipleActiveResultSets = True";
Here is another company's connection example: http://www.mediafire.com/file/kh3k5z...6-0-2.rar/file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|