473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

retrieving data

hii..i m trying to access a database using the foll code..
Expand|Select|Wrap|Line Numbers
  1. private void Page_Load(object sender, System.EventArgs e)
  2.  
  3. SqlConnection con;
  4. SqlDataReader dr;
  5. SqlCommand cmd;
  6. con = new SqlConnection("Server=ADNAN;Database=system;UID=sa;pwd=");
  7. cmd = new SqlCommand("Select * from info",con);
  8. con.Open();
  9. dr= cmd.ExecuteReader();
  10. Repeater1.DataSource= dr;
  11. Repeater1.DataBind();
  12. dr.Close();
  13. con.Close();
  14.  
the error which i get is
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.

when i remove the user id and the password from the connection, recieves a msg "Login failed for user 'ADNAN\ASPNET"
May 27 '07 #1
1 801
Frinavale
9,735 Expert Mod 8TB
hii..i m trying to access a database using the foll code..
Expand|Select|Wrap|Line Numbers
  1. private void Page_Load(object sender, System.EventArgs e)
  2.  
  3. SqlConnection con;
  4. SqlDataReader dr;
  5. SqlCommand cmd;
  6. con = new SqlConnection("Server=ADNAN;Database=system;UID=sa;pwd=");
  7. cmd = new SqlCommand("Select * from info",con);
  8. con.Open();
  9. dr= cmd.ExecuteReader();
  10. Repeater1.DataSource= dr;
  11. Repeater1.DataBind();
  12. dr.Close();
  13. con.Close();
  14.  
the error which i get is
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.

when i remove the user id and the password from the connection, recieves a msg "Login failed for user 'ADNAN\ASPNET"
You're connection string should look like:
Expand|Select|Wrap|Line Numbers
  1. concStr="data source=<nameOfDatabaseServer>;initial catalog=<nameOfDatabase>;user id=<databaseUserId>;password=<passwordForDatabaseUser>"
  2.  
Hope this helps

-Frinny
May 28 '07 #2

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

Similar topics

0
by: Alistair | last post by:
Hi all, I am creating a database based site that keeps track of books, who has read them and the comments they have. After a little help in M.P.I.asp.DB I managed to create a database (access...
1
by: Rushabh Dadbhawala | last post by:
Problem: I am fetching data from the database, storing it in a dataSet, and binding it with a Data Grid. The DataGrid controls allows sorting. The problem is that when the data is sorted on one...
5
by: aniket_sp | last post by:
i am using a data adapter and a dataset for filling and retrieving data into .mdb database. following is the code..... for the form load event Dim dc(0) As DataColumn Try If...
0
by: kid4rilla | last post by:
I can successfully write the binary data to an image data type, and successfully retrieve it, but when I attempt to play the file in media player after retrieving it, I get the file type isn't...
1
by: Dave | last post by:
Can some help me out retrieving word, pdf, etc. docs and streaming to the browser? I'm saving the docs as an image data type along with it's original filename and retrieving them using a...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
6
by: AlveenX | last post by:
Hi, I am trying to pick a Guid from a data row using the following code: foreach(DataRow row in MyDataTable.Rows) { (Guid)row }
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
1
by: san123456789 | last post by:
Hi, Im using a MS SQL server to store images... Im creating a windows form application using C#. I need to store and retrieve images from the database. This is my code to store images: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.