473,795 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# connects to SQL Server Database

5 New Member
Hi I'm newbie in C# database programming and SQL Server as well.

I am using windows XP on my laptop. MSSQLServer Client is installed. The connection is set to use Windows authentication. My windows user name is "stephanie cat" without any password.

I use C# in VS.NET 2003 to connect to SQL Server database (a simple console application). The northwind database has been downloaded and attached to current SQL Server instance. I can view the northwind database ok in Enterprise Manager.

The connection string is:
Expand|Select|Wrap|Line Numbers
  1. SqlConnection mySqlConnection = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=sa");
  2.  
It didn't work.
So I set up a user "sa" with a pwd in "local user and groups" of "computer management". It didn't work.

Then I think since the SQL server is using windows authentication, I delete "uid=sa;pwd =sa" in the connection string. It didn't work.

I changed "uid= Stephanie cat; pwd=". It didn't work.

Then i try to change SQL server connection into SQL server authentication. It failed with a message:"Login failed for user 'sa'. Reason: not associated with a trusted SQL Server connection." but how do I associated a user with a trusted SQL Server connection. does the user have to be a windows user name. But in XP, there is no DBA group. I am confused about this sa uid.

could anybody help me with it please?
Apr 19 '07 #1
0 1543

Sign in to post your reply or Sign up for a free account.

Similar topics

2
391
by: Rhek | last post by:
Hello, I am hoping that someone can provide a code sample using the following sample information below. I am wanting to create a vb.net application that is run on a local computer and connects to our database on our website. I have seen some connection strings for SQL but not MS Access. I think they would be close to the same but not really sure. database MS Access: test.mdb IP Address: 123.456.78.00
0
1335
by: Visu | last post by:
DB2 7.2 EEE AIX 5.2 Instance is partitioned over two servers. Server A - Catalog node & 4 data node Server B - 4 data node Local and remote connection times to the only database on this instance
2
1445
by: Voyager | last post by:
Hi, Where can I find a sample vb.net application that connects to an MS Access database and does sql statement calls to retrieve, update etc...? I do not have the vb resource kit and cannot download it due to internet connections where I am. I have spent many hours and failed to do this as a new comer to vb.net. Perhaps I could download a sample app and copy and paste
0
904
by: Johannes Barop | last post by:
Hello, I search a way to realize following: When a user connects to a databse, a function of my should be executed. The best would be a system table where the active Databaser Users are in, and creating a Trigger on it. But there is not such a table. Sometold me to modifying the source, but i feel a bit lost in such a big source. Please help me :) The best would be a modification which stores active Users in table. I think
12
2730
by: mistral | last post by:
phpMyAdmin 2.6.2 problem: can no connects to mySQL database: each time shown error #1045 - Access denied for user 'username'@'192.168.1.2' (using password: YES) Is seems, this is most common problem for mySOL and phpMyAdmin. Extremelly ugly and inconvenient program.
1
1048
by: LamSoft | last post by:
Is there any method to let aspx connects to WMI to get system information. I found that there is a method called "System.Management.ManagementObjectSearcher, but when I tried to import it, the VS.NET said "namespace or type specified in the Imports.... does not contain any public member or cannot be found. What did I missing?
1
2978
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and recompiling/executing the code with 1.4.1 (deploying the newly compiled stored procedure code as well). This is the original exception that I got before I tried any code modifications: java.io.IOException: invalid offset/length at...
2
1912
by: bmamo | last post by:
HI, i have a problem similar to this one, but mainly the problem is that my php connects to the mails server, but disconnects immediately. for example: here is the log of the mail server: #Software: Microsoft Internet Information Services 6.0 #Version: 1.0 #Date: 2007-08-07 15:00:23 #Fields: date time c-ip s-sitename s-computername s-ip s-port cs-method sc-bytes cs-host 2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0...
6
3594
by: DevX | last post by:
Hello, I have a big intranet that I run with IIS 6.0. I need to log the client's machine names, and I found on the web istruction on how to use REMOTE_HOST server variable while enabling Reverse DNS on IIS. Using also a query to the DNS retrieves only the names of machine that are registered in the DNS (like servers).
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.