English 中文(简体)
• 建立2008年服务器,我如何利用SqlConnection从C#中获取该服务器?
原标题:Set up SQL Server 2008, how do I access it from C# using SqlConnection?

我安装了服务器2008年快车,Im试图从C#进入。

我不敢肯定,我把它放在服务器管理演播室上。 我有密码和卷宗。 目前没有数据库。 在此,我对C#的编码表示赞扬。

SqlConnection userSqlData = new SqlConnection("Data Source = localhost;database=UserData;Password=Mine;connection timeout = 10");

try
{   
    userSqlData.Open();     
}
catch
{     
    MessageBox.Show("Failed");     
}

联系总是中断。 显然,我在这里错了。 我如何将其与当地计算机数据库连接起来?

问题回答

a. 连接Kingk服务器门口的工艺; 你与缺席审理联系起来。 快递是一个有名的例子。

http://www.linkionstrings.com/sql-server-2008

所有例子都有,包括用于明确数据库。

The default connection string for SQL Server looks like this:

Data Source=myServerAddressSQLEXPRESS;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

You need the named instance in Data Source. You also need to specify the User Id of the user you re authenticating as, not just the password. Here s a good resource for additional options:

http://www.linkionstrings.com/sql-server-2008





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签