473,394 Members | 1,951 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,394 software developers and data experts.

C#-App : COnnection to SQL Server 2005

hello....i need your help. i got an assignment about prediction in data mining. and the problem is, i'm new in C# and data mining. i've tried to search an example in sql server site but when i try it into my project it wont worked. an sql exception was made. here is some part of the code :
using System;
using Microsoft.AnalysisServices;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;

namespace AMOSampleForDM
{
public Database CreateDatabase(Server srv, string databaseName)
{
Database dbNew = new Database(databaseName, Utils.GetSyntacticallyValidID(databaseName, typeof(Database))) ;

if (srv.Databases.ContainsName(databaseName))
srv.Databases.RemoveAt(srv.Databases.IndexOfName(d atabaseName));


srv.Databases.Add(dbNew);
dbNew.Update(true);

return dbNew;
}
[STAThread]
static void Main(string[] args)
{

try
{
Server srv = new Server();

srv.Connect("localhost");

Database db = CreateDatabase(srv, "Test");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

and the exception is "make sure that the "sql browser" is running. cannot made a connection because the target machine is actively refused it." i really confused, because i'm make sure that the sql browser and server are running.
could anyone help me with this problem or would you give me another example about data mining in C#???? please i really need your help...

thanks a lot,

angela
Jul 12 '08 #1
1 1130
kenobewan
4,871 Expert 4TB
If localhost is your connection string then you haven't supplied a proper connection. You normally have to give other details and credentials. HTH.
Jul 12 '08 #2

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

Similar topics

1
by: Carlos | last post by:
Hi all, I have a ASP.NET app that uses SQL Server 2000 to access the data over the internet and everything works fine . However, I just installed SQL server 2005, and wanted to test the remote...
4
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at...
7
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at...
10
by: MVChauhan | last post by:
Hi We are planning to move over to SQL Server 2005 in near future. At the moment Website is on a seperate server then the Database. OS for both the server is Window 2003 and currently our data...
3
by: Arpan | last post by:
I recently installed SQL Server 2005 (Management Studio Express) along with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro m/c & use IIS 5.0 to run ASPX projects. I could add my...
9
by: Gabriel | last post by:
Hello, I installed SQL server 2005 SP1 on a Windows XP SP2 From Visual Studio, I'm trygin to create a connection to a database, but I receive this error but I'm creating the connection (I...
3
by: Lee T. Hawkins | last post by:
I am having a number of problems over the last two full days trying to get an ASP.NET 2.0 application to connect to a SQL Server 2005 database... First off, I built this application w/ Visual...
1
by: Steve | last post by:
Hi All I have a windows application (written in VB.net 2005) which I update via web downloads to my clients computers The downloaded file is saved in a subfolder until the next time the...
1
by: =?Utf-8?B?QiBTaW5naA==?= | last post by:
Hi Scenario 1) Host - XP Laptop with internet connection using Sky Broadband Wireless Router Netgear DG834GT 2) MS Virtual Server 2005 - I have deployed an XP MS Virtual Server 2005 to act...
1
by: bimowidhi | last post by:
Hi, I'm a newbie here, and also in PHP. Sorry for my bad English. I've walked around to find the answer of my problem, but I still can't get it. I develop PHP 5.2.5 Application, using SQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.