Showing posts with label connected. Show all posts
Showing posts with label connected. Show all posts

Tuesday, March 20, 2012

Query Error

Hi all,

I'm a new guy trying to tutor myself on MRS and I'm using

SQL05DEV on my desktop. I managed to finally get connected to

AdventureWorks db, but when I run this query:

SELECT S.OrderDate, S.SalesOrderNumber, S.TotalDue, C.FirstName, C.LastName
FROM HumanResources.Employee E INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Sales.SalesOrderHeader S ON E.EmployeeID = S.SalesPersonID

=====================================================

I get this error:

TITLE: Microsoft Report Designer

An error occurred while executing the query.
Invalid object name 'HumanResources.Employee'.


ADDITIONAL INFORMATION:

Invalid object name 'HumanResources.Employee'. (Microsoft SQL Server, Error: 208)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476

--

Any tips for troubleshooting?

How would Icheck to see if the human resources table even exists?

Thanks,

>Scott

Hi,

* Have you check if you have change database name !!!?

SELECT S.OrderDate,

S.SalesOrderNumber,

S.TotalDue,

C.FirstName,

C.LastName

FROM adventureworks.humanresources.Employee E

INNER JOIN

adventureworks.person.Contact C

ON E.ContactID = C.ContactID

INNER JOIN

adventureworks.sales.SalesOrderHeader S

ON E.EmployeeID = S.SalesPersonID

this runs fine on my machine.

|||

Hemantgiri,

Thanks for responding and showing me your SQL.

I tried it on my machine and no luck. I get the error below when I run

the SQL that works on your machine. Do you have any suggestions?

I seem to have something misconfigured on my machine.

Thank You again,

Scott

TITLE: Microsoft Report Designer

An error occurred while executing the query.
Invalid object name 'adventureworks.humanresources.Employee'.


ADDITIONAL INFORMATION:

Invalid object name 'adventureworks.humanresources.Employee'. (Microsoft SQL Server, Error: 208)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3033&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476


|||

Hi,

Are you able to see the database in SSMS and able to open any table !!!

Hemantgiri S. Goswami

Query Error

Hi all,

I'm a new guy trying to tutor myself on MRS and I'm using

SQL05DEV on my desktop. I managed to finally get connected to

AdventureWorks db, but when I run this query:

SELECT S.OrderDate, S.SalesOrderNumber, S.TotalDue, C.FirstName, C.LastName
FROM HumanResources.Employee E INNER JOIN
Person.Contact C ON E.ContactID = C.ContactID INNER JOIN
Sales.SalesOrderHeader S ON E.EmployeeID = S.SalesPersonID

=====================================================

I get this error:

TITLE: Microsoft Report Designer

An error occurred while executing the query.
Invalid object name 'HumanResources.Employee'.


ADDITIONAL INFORMATION:

Invalid object name 'HumanResources.Employee'. (Microsoft SQL Server, Error: 208)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476

--

Any tips for troubleshooting?

How would Icheck to see if the human resources table even exists?

Thanks,

>Scott

Hi,

* Have you check if you have change database name !!!?

SELECT S.OrderDate,

S.SalesOrderNumber,

S.TotalDue,

C.FirstName,

C.LastName

FROM adventureworks.humanresources.Employee E

INNER JOIN

adventureworks.person.Contact C

ON E.ContactID = C.ContactID

INNER JOIN

adventureworks.sales.SalesOrderHeader S

ON E.EmployeeID = S.SalesPersonID

this runs fine on my machine.

|||

Hemantgiri,

Thanks for responding and showing me your SQL.

I tried it on my machine and no luck. I get the error below when I run

the SQL that works on your machine. Do you have any suggestions?

I seem to have something misconfigured on my machine.

Thank You again,

Scott

TITLE: Microsoft Report Designer

An error occurred while executing the query.
Invalid object name 'adventureworks.humanresources.Employee'.


ADDITIONAL INFORMATION:

Invalid object name 'adventureworks.humanresources.Employee'. (Microsoft SQL Server, Error: 208)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3033&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476


|||

Hi,

Are you able to see the database in SSMS and able to open any table !!!

Hemantgiri S. Goswami

Saturday, February 25, 2012

Query by database or code

I have a database and would like to retrieve specific data via queries. This database is also connected to an ASP .Net 2.0 application to be the front end. Ive created the query in the database. Would you recommend i use parameter names to retrieve the data via code or should i have the query within my code to retrieve the data?

Thanks

I'm not exactly sure what you are asking. Are you asking whether or not to do your database access from the ASPX page or the code-behind? Or, are you asking if you should parameterize your queries?

|||

Im using ASP.Net to create a website and heres and example of how i retrieve the data:

Dim strCommandText as String= "SELECT * FROM Player INNER JOIN Manufacturer ON Player.PlayerManufacturerID =
Manufacturer.ManufacturerID ORDER BY Player.PlayerName"
Dim myCommand As SqlCommand = new SqlCommand(strCommandText, myConnection)

Now above i write the SQL syntax into my application to retrieve data. If i have a query created within the DATABASE called ParameterName then i can write the code as:

MyCommand.Paramters.Add(ParameterName)

So my question is really asking which method is approved and why as theyre both doing the same thing?

Thanks

|||

If I still misunderstood your question, then my apologies, but I think what you're asking is if your Select statement requires parameters, then should I inject them directly into my statement, or use a parameter, and add the parameters afterwards. If this is what you're truly asking, then I'd definetely suggest the use of parameters as they create a much less error-proned design. Here's an article on the subject:

http://www.4guysfromrolla.com/webtech/092601-1.shtml

|||

The "common" best practice approach would be to have a separate class library that will return the "Players" via a stored procedure. I would also recommend not using SELECT *, you should only select the fields you need.

|||

If I still misunderstood your question, then my apologies, but I think what you're asking is if your Select statement requires parameters, then should I inject them directly into my statement, or use a parameter, and add the parameters afterwards. If this is what you're truly asking, then I'd definetely suggest the use of parameters as they create a much less error-proned design. Here's an article on the subject:

http://www.4guysfromrolla.com/webtech/092601-1.shtml

Not quite. Im just trying to see if i should use a Select query in my code or should i call aparameter Stored Procedure from the database to retrieve the data. Sorry my fault i was using the wrong terminology, i should have said Stored Procedure but got my wires crossed as ASP .Net terms this as a parameter being passed in to the code your writing

jguadagno:

The "common" best practice approach would be to have a separate class library that will return the "Players" via a stored procedure. I would also recommend not using SELECT *, you should only select the fields you need.

I think this may have answered the question. Where can i get started with Class libraries? also thanks for advising not to use SELECT * - i only used that in this question as an example.

Thanks guys

|||

EssCee:

I think this may have answered the question. Where can i get started with Class libraries?

http://www.15seconds.com/issue/050721.htm