473,486 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

database connection

Please,I have made database in Sql server. How to connect
with it? It is,lets say,in C:\temp and its name is
database1. What do I need to put here:
SqlConnection conn=new SqlConnection("Data
Source=localhost;User Id=sa;Password=pwd;Initial
Catalog=database1;");?
When I put this it doesn't work. When I put whatever it
doesn't work and it doesn't show error message.
Tahnk you
Nov 15 '05 #1
3 1656
Is your database attached to SQL Server? If not you will have to attach teh
file first. There may be a connection string option that connects the file,
but I don't know what it is offhand.
Now, the connection string isn't tested until you call conn.Open() I don't
think, try calling the open method on your connection object and seeing what
exception is thrown, then post back.
"djozy" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Please,I have made database in Sql server. How to connect
with it? It is,lets say,in C:\temp and its name is
database1. What do I need to put here:
SqlConnection conn=new SqlConnection("Data
Source=localhost;User Id=sa;Password=pwd;Initial
Catalog=database1;");?
When I put this it doesn't work. When I put whatever it
doesn't work and it doesn't show error message.
Tahnk you

Nov 15 '05 #2
I am trying to conect my application with SQL Server
database using connection string. But I don't know how to
specify location of my database and table which I want to
use. I have done what you had said to me ant this
exception has been thrown: "Login failed for user 'JOSIP-
SKY2IGFE7\ASPNET'". 'JOSIP-SKY2IGFE7' is name of my local
server.Thank you for reply
-----Original Message-----
Is your database attached to SQL Server? If not you will have to attach tehfile first. There may be a connection string option that connects the file,but I don't know what it is offhand.
Now, the connection string isn't tested until you call conn.Open() I don'tthink, try calling the open method on your connection object and seeing whatexception is thrown, then post back.
"djozy" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Please,I have made database in Sql server. How to connect with it? It is,lets say,in C:\temp and its name is
database1. What do I need to put here:
SqlConnection conn=new SqlConnection("Data
Source=localhost;User Id=sa;Password=pwd;Initial
Catalog=database1;");?
When I put this it doesn't work. When I put whatever it
doesn't work and it doesn't show error message.
Tahnk you

.

Nov 15 '05 #3

"djozy" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
I am trying to conect my application with SQL Server
database using connection string. But I don't know how to
specify location of my database and table which I want to
use. I have done what you had said to me ant this
exception has been thrown: "Login failed for user 'JOSIP-
SKY2IGFE7\ASPNET'". 'JOSIP-SKY2IGFE7' is name of my local
server.Thank you for reply


Ok, that means your ASPNET user doesn't have access to the SQL server. You
will either have to have to set that in SQL Server or you need to login with
an sql login. The default catalog is the database, and the table is
specified in the individual sql statements you issue, not in the connection
string.
-----Original Message-----
Is your database attached to SQL Server? If not you will

have to attach teh
file first. There may be a connection string option that

connects the file,
but I don't know what it is offhand.
Now, the connection string isn't tested until you call

conn.Open() I don't
think, try calling the open method on your connection

object and seeing what
exception is thrown, then post back.
"djozy" <an*******@discussions.microsoft.com> wrote in

message
news:03****************************@phx.gbl...
Please,I have made database in Sql server. How to connect with it? It is,lets say,in C:\temp and its name is
database1. What do I need to put here:
SqlConnection conn=new SqlConnection("Data
Source=localhost;User Id=sa;Password=pwd;Initial
Catalog=database1;");?
When I put this it doesn't work. When I put whatever it
doesn't work and it doesn't show error message.
Tahnk you

.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2395
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
11
2396
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
3
2471
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I...
14
4776
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
7
2453
by: Lau Lei Cheong | last post by:
Hello, Actually I think I should have had asked it long before, but somehow I haven't. Here's the scenerio: Say we have a few pages in an ASP.NET project, each of them needs to connect to...
3
10270
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
4803
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
6
3428
by: Arsalan Ahmad | last post by:
Hi all, I am creating a website in which in an Item detail page there are a number of web controls (7 or 8) and what is happening that inside each of control's Page_Load() function I am creating...
22
60143
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
1
27048
Curtis Rutland
by: Curtis Rutland | last post by:
How To Use A Database In Your Program Part II This article is intended to extend Frinny’s excellent article: How to Use a Database in Your Program. Frinny’s article defines the basic concepts...
0
6964
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
7126
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
7175
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
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
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
4559
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...
0
3070
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...

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.