Showing posts with label connect. Show all posts
Showing posts with label connect. Show all posts

Sunday, March 25, 2012

computer unable to connect to sql

My specific computer is not able to connect to SQL through ODBC link, anyone
have any ideas what can block a computer? Please read relevant information
below
-Other users on their computers can log into database using DNS
-I can log into database if I am logged onto a different computer
-Other users logged onto my computer cannot access the database
The purpose for this is I have created many DAPs, queries etc in access for
a time tracking program we use. Last week we upsized the database to MSDE
to mitigate corruption. To try and save time, I am trying to recreate the
access database (front end) using linked tables so all my queries, DAPs, etc
will work.
If this is the wrong group for this question, please direct me to the
correct location. Also I am not an IT or database admin so I am not sure if
I supplied all the information needed. If more info needed, just tell me
what you need.
Many Thanks
Paul D
"PaulD" <nospam> wrote in message
news:uvBZweOMGHA.208@.tk2msftngp13.phx.gbl...
: My specific computer is not able to connect to SQL through ODBC link,
anyone
: have any ideas what can block a computer? Please read relevant information
: below
:
: -Other users on their computers can log into database using DNS
: -I can log into database if I am logged onto a different computer
: -Other users logged onto my computer cannot access the database
:
: The purpose for this is I have created many DAPs, queries etc in access
for
: a time tracking program we use. Last week we upsized the database to MSDE
: to mitigate corruption. To try and save time, I am trying to recreate the
: access database (front end) using linked tables so all my queries, DAPs,
etc
: will work.
:
: If this is the wrong group for this question, please direct me to the
: correct location. Also I am not an IT or database admin so I am not sure
if
: I supplied all the information needed. If more info needed, just tell me
: what you need.
:
: Many Thanks
: Paul D
:
Found the answer, in the library configuration changed network libraries
from TCP/IP to Named Pipes and all is well.

Sunday, February 19, 2012

compiler is not recognizing my using statement for SglConnection statement

I am using ASP.NET 2.0, and am attempting to write some code to connect to the database and query a data table. The compiler is not recognizing my SqlConnection statement. It does recognize other commands. And just to make sure, I created other sql objects such as ObjectDataSource and SqlDataSource. The compiler does not find a problem with that code.

Basically the compiler is telling me that I am missing a "using" directive. The compiler is wrong though, because I am including the statement "usingSystemData" Can someone please take a look at my code below and to see if you notice what the problem might be? Note that I numbered the lines of code below. Note that I also tried putting lines 3 trhough 6 before line 2(The page directive) but that did not fix the problem The compiler still gives me the same compiler message.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request.Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?)Source Error:

Line 21: SqlConnection sqlConn = new SqlConnection("server=localhost;uid=sa;pwd=password;database=master;");

1 <asp:sqldatasource runat="server"></asp:sqldatasource>

2 <%@. Page Language="C#"%>

3 using System;

4 using System.Data;

5 using System.Collections;

6 using System.Data.SqlClient;

7

8 <script runat=server>

9

10 protected void Page_Load(object o, EventArgs e)

11 {

12 ObjectDataSource dsa; // This works no problems from the compiler here

13 SqlDataSource ds; // This works no problems from the compiler

14

15 if (IsPostBack)

16 {

17 if (AuthenticateUser(txtUsername.Text,txtPassword.Text))

18 {

19 instructions.Text = "Congratulations, your authenticated!";

20 instructions.ForeColor = System.Drawing.Color.Red;

21 SqlConnection sqlConn = new SqlConnection("server=localhost;uid=sa;pwd=password;database=master;");

22 String sqlStmt = "Select UserName from LogIn where UserName='" + txtUsername.Text + "' and password='" + sHashedPassword + "'";

23 }

24 else

25 {

26 instructions.Text = "Please try again!";

27 instructions.ForeColor = System.Drawing.Color.Red;

28 }

29 }

30

31 }

32

33 bool AuthenticateUser(string username, string password)

34 {

35 // Authentication code goes here

36

37 }

When using the in-line server code instead of code-behind, you have to use the following syntax instead:

<%@. Import Namespace="System.Data.SqlClient" %>

Friday, February 17, 2012

Compilation Error

I'm trying to connect to an SQL database through my asp.net page and I'm getting an Compiler Error Message: BC30188: Declaration expected for the following codes:

DBConn= New OledbConnection("Provider=sqloledb;" _

DBInsert.Commandtext = "Insert Into GuestInfo" _

DBInsert.Connection =DBConn

DBInsert.Connection.Open

DBInsert ExecuteNonQuery()

What I'm trying to do is connect to the SQL database and input new information to the database.

This is the entire code for connecting and entering info into the database. The SQL Database's name is HMS. I'm stuck and I can't figure it out.

Dim DBConn as oledbConnection
Dim DBInsert As New oledbCommand
DBConn= New OledbConnection("Provider=sqloledb;" _
& "server=localhost;" _
& "Initial Catalog=HMS;" _
& "User id=sa;" _
& "Password=yourpassword;")
DBInsert.Commandtext = "Insert Into GuestInfo" _
& "(FirstName,Lastname,Address,City,State,Zipcode) values ('" _
&"'" & txtFirstName.Text & "', " _
&"'" & txtLastName.Text & "', " _
&"'" & txtAddress.Text & "', " _
&"'" & txtCity.Text &"', " _
&"'" & txtState.Text &"', " _
&"'" & txtZipCode.Text &"', ")"
DBInsert.Connection =DBConn
DBInsert.Connection.Open
DBInsert ExecuteNonQuery()I imagine it is the way you are continuing the lines. Try:


DBConn= New OledbConnection("Provider=sqloledb;" & _
"server=localhost;" & _

and so on...|||I just tryed your suggestion and I'm still getting the same error message for all the codes listed.|||if you are connecting to sql database why are you using oledbconnection ? use the sqlconnection. check www.connectionstrings.com for some sample connection strings.

hth

Tuesday, February 14, 2012

Compatibility of AS with Excel 2000

can i use excel 2000 to connect to as 2005 data source?

cherriesh

You should be able to, as long as the latest OLE DB for OLAP Provider is installed on the client and supports AS 2005 (ie. MSOLAP.3).

Feature Pack for Microsoft SQL Server 2005 - February 2007

...

Microsoft SQL Server 2005 Analysis Services 9.0 OLE DB Provider

The Analysis Services 9.0 OLE DB Provider is a COM component that software developers can use to create client-side applications that browse metadata and query data stored in Microsoft SQL Server 2005 Analysis Services. This provider implements both the OLE DB specification and the specification’s extensions for online analytical processing (OLAP) and data mining.

...

|||

How to connect Excel 2003 or an earlier version of Excel to SQL Server 2005 Analysis Services
http://support.microsoft.com/kb/940167