|
-
October 29th, 2011, 11:46 AM
#1
Connection String
Hi all and thanks in advanced for the help.
I am VERY New to C#, and I have been playing around by watching videos in youtube etc.
I come from the Delphi world. This is the problem I am getting
In my delphy ADOconnection String (Which works very well) I have
Data Source: 0166-PC\PDSTAFFING
Initial Catalog: PDSTAFFING
User ID: calosa_canis
I am using Windows authentication to login into the Database
In my C#2010 I have the following but I can't connect and gives me a Login Failure error.
Hope you can help me out
Once again thanks for all the help.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.Sql;
namespace Test3
{
public partial class Form1 : Form
{
SqlConnection MainConnection = new SqlConnection("Data Source=0166-PC\\PDSTAFFING;User Id=carlosa_canis;Initial Catalog=PDSTAFFING;");
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
MainConnection.Open();
MainConnection.Close();
}
catch (Exception error)
{
MessageBox.Show(error.ToString());
}
}
}
}
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
|