Showing posts with label northwind. Show all posts
Showing posts with label northwind. Show all posts

Monday, March 26, 2012

Newbie question

Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age
_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?Seems that either the object doesn=B4t exist or you are connected to the
wrong database (ont the object surely doesn=B4t exists there). Try to
check this.
HTH, Jens Suessmeyer.|||Who is the owner of the table? If it is not dbo you need to specify who the
owner is. Actually it is always a good idea to specify the owner even if it
is dbo.
FROM [YourOwner].[ascis_acadyear_setup]
Andrew J. Kelly SQL MVP
"Allison" <,> wrote in message
news:44007a16$0$6995$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can connect to Northwind and Pubs (the samples) and do simple selections
> on them. At work we have a personnel database which I am tesing at home.
> I can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [a
ge_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>|||>>Very sorry for offending you - newbies need help not a slapped wrist
I can't speak for Jens but I believe his reply was quite polite with no
'slapping' intended. As you can see, he is trying to help you in your other
thread.
Multi-posting is a common mistake newbies make and it's appropriate to point
this out so that it can be avoided it in the future. With multiple
independent threads, there's a lot of duplicate effort going on to help you
out.
If you need to post the same question to different forums, you can
cross-post by specify multiple newsgroups in the list and replies will
appear in the all the forums posted.
Hope this helps.
Dan Guzman
SQL Server MVP
"Allison" <,> wrote in message
news:440086ed$0$6962$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Jens" <Jens@.sqlserver2005.de> wrote in message
> news:1140883638.016887.92390@.e56g2000cwe.googlegroups.com...
>

Friday, March 23, 2012

Newbie question

Hi,
Can one Full-Text Catalog apply to more than one tables?
e.g. I need Full-Text Catalog in Northwind that needs to apply to
Customers and Categories table, should I create one Catalog for two tables or
one catelog for each table?
what is the difference?
Thanks a lot
Ed
Hi Ed,
Yes, a FT Catalog can have more than one table in it, but the reverse (one
table in more than one FT Catalog) is not true.
For the Northwind example, you can do either, but for a better explanation
on the issues see, the last paragraph in the SQL Server 2000 BOL title
"Full-text Search Recommendations".
Regards,
John
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:FA3CB9AB-2B76-498C-A9EC-15B76D2F578A@.microsoft.com...
> Hi,
> Can one Full-Text Catalog apply to more than one tables?
> e.g. I need Full-Text Catalog in Northwind that needs to apply to
> Customers and Categories table, should I create one Catalog for two tables
or
> one catelog for each table?
> what is the difference?
> Thanks a lot
> Ed

Newbie question

Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?
Seems that either the object doesn=B4t exist or you are connected to the
wrong database (ont the object surely doesn=B4t exists there). Try to
check this.
HTH, Jens Suessmeyer.
|||Who is the owner of the table? If it is not dbo you need to specify who the
owner is. Actually it is always a good idea to specify the owner even if it
is dbo.
FROM [YourOwner].[ascis_acadyear_setup]
Andrew J. Kelly SQL MVP
"Allison" <,> wrote in message
news:44007a16$0$6995$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can connect to Northwind and Pubs (the samples) and do simple selections
> on them. At work we have a personnel database which I am tesing at home.
> I can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>
|||>>Very sorry for offending you - newbies need help not a slapped wrist
I can't speak for Jens but I believe his reply was quite polite with no
'slapping' intended. As you can see, he is trying to help you in your other
thread.
Multi-posting is a common mistake newbies make and it's appropriate to point
this out so that it can be avoided it in the future. With multiple
independent threads, there's a lot of duplicate effort going on to help you
out.
If you need to post the same question to different forums, you can
cross-post by specify multiple newsgroups in the list and replies will
appear in the all the forums posted.
Hope this helps.
Dan Guzman
SQL Server MVP
"Allison" <,> wrote in message
news:440086ed$0$6962$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Jens" <Jens@.sqlserver2005.de> wrote in message
> news:1140883638.016887.92390@.e56g2000cwe.googlegro ups.com...
>

Newbie question

Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?
It's possible that the object owner is not yourself or dbo. Try the
following:
select
table_schema
from
information_schema.tables
where
table_name = 'ascis_acadyear_setup'
This will tell you who the owner is. Then use two-part naming:
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [TheOwner].[ascis_acadyear_setup]
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Allison" <,> wrote in message
news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?
|||Please do not multipost, answered in connect.
HTH, jens Suessmeyer.
|||"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1140883638.016887.92390@.e56g2000cwe.googlegro ups.com...
> Please do not multipost, answered in connect.
> HTH, jens Suessmeyer.
>Very sorry for offending you - newbies need help not a slapped wrist
|||"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time

> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>
|||>>Very sorry for offending you - newbies need help not a slapped wrist
I can't speak for Jens but I believe his reply was quite polite with no
'slapping' intended. As you can see, he is trying to help you in your other
thread.
Multi-posting is a common mistake newbies make and it's appropriate to point
this out so that it can be avoided it in the future. With multiple
independent threads, there's a lot of duplicate effort going on to help you
out.
If you need to post the same question to different forums, you can
cross-post by specify multiple newsgroups in the list and replies will
appear in the all the forums posted.
Hope this helps.
Dan Guzman
SQL Server MVP
"Allison" <,> wrote in message
news:440086ed$0$6962$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Jens" <Jens@.sqlserver2005.de> wrote in message
> news:1140883638.016887.92390@.e56g2000cwe.googlegro ups.com...
>
|||?
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Allison" <,> wrote in message
news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time

> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>
|||I think she thanked you (just kind of hidden):
[vbcol=seagreen]
Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>
>
|||Thanx, Adam. It was buried in there somewhere.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23QiIKVmOGHA.1088@.tk2msftngp13.phx.gbl...
I think she thanked you (just kind of hidden):
[vbcol=seagreen]
Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>
>

Newbie question

Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age
_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?It's possible that the object owner is not yourself or dbo. Try the
following:
select
table_schema
from
information_schema.tables
where
table_name = 'ascis_acadyear_setup'
This will tell you who the owner is. Then use two-part naming:
SELECT [acadyear_setup_id], [narrative], [census_date], [age
_as_at_date]
FROM [TheOwner].[ascis_acadyear_setup]
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Allison" <,> wrote in message
news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age
_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?|||Please do not multipost, answered in connect.
HTH, jens Suessmeyer.|||"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1140883638.016887.92390@.e56g2000cwe.googlegroups.com...
> Please do not multipost, answered in connect.
> HTH, jens Suessmeyer.
>Very sorry for offending you - newbies need help not a slapped wrist|||"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [a
ge_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time

> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [a
ge_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>|||>>Very sorry for offending you - newbies need help not a slapped wrist
I can't speak for Jens but I believe his reply was quite polite with no
'slapping' intended. As you can see, he is trying to help you in your other
thread.
Multi-posting is a common mistake newbies make and it's appropriate to point
this out so that it can be avoided it in the future. With multiple
independent threads, there's a lot of duplicate effort going on to help you
out.
If you need to post the same question to different forums, you can
cross-post by specify multiple newsgroups in the list and replies will
appear in the all the forums posted.
Hope this helps.
Dan Guzman
SQL Server MVP
"Allison" <,> wrote in message
news:440086ed$0$6962$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Jens" <Jens@.sqlserver2005.de> wrote in message
> news:1140883638.016887.92390@.e56g2000cwe.googlegroups.com...
>|||?
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Allison" <,> wrote in message
news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [a
ge_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time

> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [a
ge_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>|||I think she thanked you (just kind of hidden):

Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>
>|||Thanx, Adam. It was buried in there somewhere.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23QiIKVmOGHA.1088@.tk2msftngp13.phx.gbl...
I think she thanked you (just kind of hidden):

Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>
>sql

Newbie question

Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?It's possible that the object owner is not yourself or dbo. Try the
following:
select
table_schema
from
information_schema.tables
where
table_name = 'ascis_acadyear_setup'
This will tell you who the owner is. Then use two-part naming:
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [TheOwner].[ascis_acadyear_setup]
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Allison" <,> wrote in message
news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
Apolgies if this seems obvious.
I am using Visual Studio and experimenting with SQL server databases. I can
connect to Northwind and Pubs (the samples) and do simple selections on
them. At work we have a personnel database which I am tesing at home. I
can connect to it and explore the contents but when I run this
SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
FROM [ascis_acadyear_setup]
I get the error invlaid object name ascis_acadyear_setup
What am I doing wrong?|||Please do not multipost, answered in connect.
HTH, jens Suessmeyer.|||"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1140883638.016887.92390@.e56g2000cwe.googlegroups.com...
> Please do not multipost, answered in connect.
> HTH, jens Suessmeyer.
>Very sorry for offending you - newbies need help not a slapped wrist|||"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time
> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>|||>>Very sorry for offending you - newbies need help not a slapped wrist
I can't speak for Jens but I believe his reply was quite polite with no
'slapping' intended. As you can see, he is trying to help you in your other
thread.
Multi-posting is a common mistake newbies make and it's appropriate to point
this out so that it can be avoided it in the future. With multiple
independent threads, there's a lot of duplicate effort going on to help you
out.
If you need to post the same question to different forums, you can
cross-post by specify multiple newsgroups in the list and replies will
appear in the all the forums posted.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Allison" <,> wrote in message
news:440086ed$0$6962$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Jens" <Jens@.sqlserver2005.de> wrote in message
> news:1140883638.016887.92390@.e56g2000cwe.googlegroups.com...
>> Please do not multipost, answered in connect.
>> HTH, jens Suessmeyer.
>>Very sorry for offending you - newbies need help not a slapped wrist
>|||?
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Allison" <,> wrote in message
news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
> It's possible that the object owner is not yourself or dbo. Try the
> following:
> select
> table_schema
> from
> information_schema.tables
> where
> table_name = 'ascis_acadyear_setup'
> This will tell you who the owner is. Then use two-part naming:
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [TheOwner].[ascis_acadyear_setup]
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .Thank you this worked first time
> "Allison" <,> wrote in message
> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
> Apolgies if this seems obvious.
> I am using Visual Studio and experimenting with SQL server databases. I
> can
> connect to Northwind and Pubs (the samples) and do simple selections on
> them. At work we have a personnel database which I am tesing at home. I
> can connect to it and explore the contents but when I run this
> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
> FROM [ascis_acadyear_setup]
> I get the error invlaid object name ascis_acadyear_setup
> What am I doing wrong?
>|||I think she thanked you (just kind of hidden):
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Columnist, SQL Server Professional
>> Toronto, ON Canada
>> www.pinpub.com
>> .Thank you this worked first time
Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>> It's possible that the object owner is not yourself or dbo. Try the
>> following:
>> select
>> table_schema
>> from
>> information_schema.tables
>> where
>> table_name = 'ascis_acadyear_setup'
>> This will tell you who the owner is. Then use two-part naming:
>> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
>> FROM [TheOwner].[ascis_acadyear_setup]
>>
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Columnist, SQL Server Professional
>> Toronto, ON Canada
>> www.pinpub.com
>> .Thank you this worked first time
>> "Allison" <,> wrote in message
>> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
>> Apolgies if this seems obvious.
>> I am using Visual Studio and experimenting with SQL server databases. I
>> can
>> connect to Northwind and Pubs (the samples) and do simple selections on
>> them. At work we have a personnel database which I am tesing at home. I
>> can connect to it and explore the contents but when I run this
>> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
>> FROM [ascis_acadyear_setup]
>> I get the error invlaid object name ascis_acadyear_setup
>> What am I doing wrong?
>>
>|||Thanx, Adam. It was buried in there somewhere.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23QiIKVmOGHA.1088@.tk2msftngp13.phx.gbl...
I think she thanked you (just kind of hidden):
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Columnist, SQL Server Professional
>> Toronto, ON Canada
>> www.pinpub.com
>> .Thank you this worked first time
Allison:
">" indicates a quote. When you want to add text in response, start
your line without that character so that we can tell when the original post
ends and the reply begins.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OhNwSAjOGHA.2012@.TK2MSFTNGP14.phx.gbl...
> ?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Allison" <,> wrote in message
> news:44008a84$0$6993$ed2619ec@.ptn-nntp-reader02.plus.net...
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVMJYMiOGHA.720@.TK2MSFTNGP14.phx.gbl...
>> It's possible that the object owner is not yourself or dbo. Try the
>> following:
>> select
>> table_schema
>> from
>> information_schema.tables
>> where
>> table_name = 'ascis_acadyear_setup'
>> This will tell you who the owner is. Then use two-part naming:
>> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
>> FROM [TheOwner].[ascis_acadyear_setup]
>>
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Columnist, SQL Server Professional
>> Toronto, ON Canada
>> www.pinpub.com
>> .Thank you this worked first time
>> "Allison" <,> wrote in message
>> news:44007a2f$0$6981$ed2619ec@.ptn-nntp-reader02.plus.net...
>> Apolgies if this seems obvious.
>> I am using Visual Studio and experimenting with SQL server databases. I
>> can
>> connect to Northwind and Pubs (the samples) and do simple selections on
>> them. At work we have a personnel database which I am tesing at home. I
>> can connect to it and explore the contents but when I run this
>> SELECT [acadyear_setup_id], [narrative], [census_date], [age_as_at_date]
>> FROM [ascis_acadyear_setup]
>> I get the error invlaid object name ascis_acadyear_setup
>> What am I doing wrong?
>>
>

Wednesday, March 7, 2012

Newbie - Whats wrong with following?

Hi,

This simple code using the Northwind db and SQL 2000...when I have the 2nd
from botton line commented out as I do now it works well and give me a
summary of the orders and totals from the [order details] table, nothing
special there.

However, if I uncomment the 'where ordervalue > 500' line and run it I get
an error that says "Invalid column name 'ordervalue' "

Any ideas?

Thanks,

td.

select
o.orderid
,o.orderdate
,c.companyname
,sum(unitprice * quantity) as ordervalue
from
orders o
join
customers c
on
o.customerid = c.customerid
join
[order details] od
on o.orderid = od.orderid
--where ordervalue > 500
group by o.orderid, c.companyname, o.orderdate"toedipper" <send_rubbish_here734@.hotmail.com> wrote in message
news:3b0pjhF6d9fg9U1@.individual.net...
> Hi,
> This simple code using the Northwind db and SQL 2000...when I have the 2nd
> from botton line commented out as I do now it works well and give me a
> summary of the orders and totals from the [order details] table, nothing
> special there.
> However, if I uncomment the 'where ordervalue > 500' line and run it I get
> an error that says "Invalid column name 'ordervalue' "
> Any ideas?
> Thanks,
> td.
>
> select
> o.orderid
> ,o.orderdate
> ,c.companyname
> ,sum(unitprice * quantity) as ordervalue
> from
> orders o
> join
> customers c
> on
> o.customerid = c.customerid
> join
> [order details] od
> on o.orderid = od.orderid
> --where ordervalue > 500
> group by o.orderid, c.companyname, o.orderdate

it is a bit complicated, but to get a useful error message try this instead
when joining you cant use a where on an agregate like that because the
column may not exist, it is based on the results

select
o.orderid
,o.orderdate
,c.companyname
,sum(unitprice * quantity) as ordervalue
from
orders o
join
customers c
on
o.customerid = c.customerid
join
[order details] od
on o.orderid = od.orderid
where sum(unitprice * quantity) > 500
group by o.orderid, c.companyname, o.orderdate

and here is how to make it work;

select
o.orderid
,o.orderdate
,c.companyname
,sum(od.unitprice * od.quantity) as ordervalue
from
orders o
join
customers c
on
o.customerid = c.customerid
join
[order details] od
on o.orderid = od.orderid

group by o.orderid, c.companyname, o.orderdate
having sum(od.unitprice * od.quantity) > 500

|||Thanks a lot, done the trick.

td.

"Lefty" <synergysynergy@.hotmail.com> wrote in message
news:424b6a22$0$57123$c30e37c6@.lon-reader.news.telstra.net...
> "toedipper" <send_rubbish_here734@.hotmail.com> wrote in message
> news:3b0pjhF6d9fg9U1@.individual.net...
>> Hi,
>>
>> This simple code using the Northwind db and SQL 2000...when I have the
>> 2nd
>> from botton line commented out as I do now it works well and give me a
>> summary of the orders and totals from the [order details] table, nothing
>> special there.
>>
>> However, if I uncomment the 'where ordervalue > 500' line and run it I
>> get
>> an error that says "Invalid column name 'ordervalue' "
>>
>> Any ideas?
>>
>> Thanks,
>>
>> td.
>>
>>
>> select
>> o.orderid
>> ,o.orderdate
>> ,c.companyname
>> ,sum(unitprice * quantity) as ordervalue
>> from
>> orders o
>> join
>> customers c
>> on
>> o.customerid = c.customerid
>> join
>> [order details] od
>> on o.orderid = od.orderid
>> --where ordervalue > 500
>> group by o.orderid, c.companyname, o.orderdate
>>
>>
> it is a bit complicated, but to get a useful error message try this
> instead
> when joining you cant use a where on an agregate like that because the
> column may not exist, it is based on the results
> select
> o.orderid
> ,o.orderdate
> ,c.companyname
> ,sum(unitprice * quantity) as ordervalue
> from
> orders o
> join
> customers c
> on
> o.customerid = c.customerid
> join
> [order details] od
> on o.orderid = od.orderid
> where sum(unitprice * quantity) > 500
> group by o.orderid, c.companyname, o.orderdate
>
> and here is how to make it work;
>
> select
> o.orderid
> ,o.orderdate
> ,c.companyname
> ,sum(od.unitprice * od.quantity) as ordervalue
> from
> orders o
> join
> customers c
> on
> o.customerid = c.customerid
> join
> [order details] od
> on o.orderid = od.orderid
> group by o.orderid, c.companyname, o.orderdate
> having sum(od.unitprice * od.quantity) > 500
>
>
>
>
>|||toedipper (send_rubbish_here734@.hotmail.com) writes:
> This simple code using the Northwind db and SQL 2000...when I have the 2nd
> from botton line commented out as I do now it works well and give me a
> summary of the orders and totals from the [order details] table, nothing
> special there.
> However, if I uncomment the 'where ordervalue > 500' line and run it I get
> an error that says "Invalid column name 'ordervalue' "

The only place in the query where you can use an alias is in the ORDER
BY clause.

However, you can use a derived table:

SELECT orderid, orderdate, companyname, ordervalue
FROM (select
o.orderid
,o.orderdate
,c.companyname
,sum(unitprice * quantity) as ordervalue
from
orders o
join
customers c
on
o.customerid = c.customerid
join
[order details] od
on o.orderid = od.orderid
group by o.orderid, c.companyname, o.orderdate) AS x
where ordervalue > 500

Another way is to write the query as:

select
o.orderid
,o.orderdate
,c.companyname
,sum(unitprice * quantity) as ordervalue
from
orders o
join
customers c
on
o.customerid = c.customerid
join
[order details] od
on o.orderid = od.orderid
group by o.orderid, c.companyname, o.orderdate
having SUM(UnitPrice * Quantity) > 500

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Newbie - Student - Help

I am working on an assignment that was due at midnight. The question is usi
ng the "Northwind database write the following SQL statements to be executed
against on of the tables within the "Northwind database"
a.) Alter a table and add a column
b.) Alter a table and add a constraint
c.) Alter a table and add an index
What I have so far is:
USE Northwind
ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
Server: Msg 156, Level 15, State 1, Line 3
I keep getting "Incorrect syntax near the keyword 'COLUMN'"
What am I doing wrong? If I can not get part 'a' then I will never get the
rest of the assignment.
Thanks in advance,
Deanna
UoP Student
deannac24@.cableone.netI am using SQL Query Analyzer
--
Deanna
UoP Student
deannac24@.cableone.net
"Deanna Cusic" <deannac24@.cableone.net> wrote in message news:11lh29913e9ngd
5@.corp.supernews.com...
I am working on an assignment that was due at midnight. The question is usi
ng the "Northwind database write the following SQL statements to be executed
against on of the tables within the "Northwind database"
a.) Alter a table and add a column
b.) Alter a table and add a constraint
c.) Alter a table and add an index
What I have so far is:
USE Northwind
ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
Server: Msg 156, Level 15, State 1, Line 3
I keep getting "Incorrect syntax near the keyword 'COLUMN'"
What am I doing wrong? If I can not get part 'a' then I will never get the
rest of the assignment.
Thanks in advance,
Deanna
UoP Student
deannac24@.cableone.net|||Deanna Cusic skrev:

> What I have so far is:
> USE Northwind
> ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
>
> Server: Msg 156, Level 15, State 1, Line 3
> I keep getting "Incorrect syntax near the keyword 'COLUMN'"
>
Have you checked Books online, the help that comes with SQL Server?
Using that you should be able to work the syntax out! Or check eg.
http://msdn.microsoft.com/library/d...
server2000.asp
if you don't have access to BOL.
Other than that, try losing the 'COLUMN' part.
/impslayer, aka Birger Johansson|||"impslayer" <impslayer@.hotmail.com> wrote in message
news:1129876626.682799.308040@.f14g2000cwb.googlegroups.com...
> Deanna Cusic skrev:
>
> Have you checked Books online, the help that comes with SQL Server?
> Using that you should be able to work the syntax out! Or check eg.
> http://msdn.microsoft.com/library/d...lserver2000.asp
> if you don't have access to BOL.
> Other than that, try losing the 'COLUMN' part.
> /impslayer, aka Birger Johansson
>
Thank you, all I did is take out 'COLUMN' and it works. I have been
wracking my brain for hours over this.
Deanna
UoP Student
deannac24@.cableone.net|||OK, thanks for your help so far but now I am stuck on the final one. I am
trying to add an index. So far I have:
use Northwind
ALTER TABLE Employees ADD [idxAddress] nvarchar(60), Address nvarchar(60)
the error I get is
Server: Msg 2705, level 16, State 4, Line 3
Column names in each table must be unique. Column name 'Address' in table
'Employees' is specified more than once.
I have tried this on many different fields including the primary keys and
still get this same error. I have even pulled up the data to check for
replication and did not find any. I am lost. I finally, thanks to help,
have part a and b, however I need part c. When I get that I can actually
get some sleep before the sun, and my children, get up ;-)
--
Deanna
"Deanna Cusic" <deannac24@.cableone.net> wrote in message
news:11lh4epilg52q9b@.corp.supernews.com...
> "impslayer" <impslayer@.hotmail.com> wrote in message
> news:1129876626.682799.308040@.f14g2000cwb.googlegroups.com...
> Thank you, all I did is take out 'COLUMN' and it works. I have been
> wracking my brain for hours over this.
> Deanna
> UoP Student
> deannac24@.cableone.net
>|||Deanna Cusic skrev:

> OK, thanks for your help so far but now I am stuck on the final one. I am
> trying to add an index. So far I have:
> use Northwind
> ALTER TABLE Employees ADD [idxAddress] nvarchar(60), Address nvarchar(60)
>
You should look for help on creating an index, not 'ALTER TABLE'...
The assignment question seemed to indicate an 'ALTER TABLE', but
you should really search for help on 'index' instead, that would
give you your desired answer!
Without Books online, you might check out:
http://msdn.microsoft.com/library/d...r />
_64l4.asp
/impslayer, aka Birger Johansson

Saturday, February 25, 2012

Newbie - SqlConnection statement

I'm trying to get a combobox to fill with values from a table. I've
set up an example using the Northwind database with the Categories
table. Dragging in the CategoryID field onto my form as a combobox,
I've set the following properties for the CategoryID combobox:
Value member = "CategoriesBindingSource - CategoryID"
Display Member = "CategoriesBindingSource - CategoryID"
This seems to bring in the correct values in the two non-index fields
(CategoryName and Description). I've then added the following code to
the combobox:
Dim Conn As SqlConnection
Conn = New SqlConnection("Database=Northwnd.mdf")
'Conn.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
CategoryID FROM Categories", Conn)
Dim ds As New DataSet
da.Fill(ds, "Categories")
CategoryIDComboBox.DataSource = ds
'CategoryIDComboBox.ValueMember = "CategoryID"
'CategoryIDComboBox.DisplayMember = "CategoryID"
End Sub
The lines that are commented out are other ideas that I've tried to no
avail. I left them here in case they are relevant.
I suspect that at least part of my problem is in the SqlDataAdapter
statement where I am pointing to the database. I am working on a
standalone pc.
Can anybody see where I am going wrong?
Thanks,
RandyHi Randy
"Randy" wrote:

> I'm trying to get a combobox to fill with values from a table. I've
> set up an example using the Northwind database with the Categories
> table. Dragging in the CategoryID field onto my form as a combobox,
> I've set the following properties for the CategoryID combobox:
> Value member = "CategoriesBindingSource - CategoryID"
> Display Member = "CategoriesBindingSource - CategoryID"
> This seems to bring in the correct values in the two non-index fields
> (CategoryName and Description). I've then added the following code to
> the combobox:
> Dim Conn As SqlConnection
> Conn = New SqlConnection("Database=Northwnd.mdf")
> 'Conn.Open()
> Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
> CategoryID FROM Categories", Conn)
> Dim ds As New DataSet
> da.Fill(ds, "Categories")
> CategoryIDComboBox.DataSource = ds
> 'CategoryIDComboBox.ValueMember = "CategoryID"
> 'CategoryIDComboBox.DisplayMember = "CategoryID"
> End Sub
> The lines that are commented out are other ideas that I've tried to no
> avail. I left them here in case they are relevant.
> I suspect that at least part of my problem is in the SqlDataAdapter
> statement where I am pointing to the database. I am working on a
> standalone pc.
> Can anybody see where I am going wrong?
> Thanks,
> Randy
>
For connection string information check out
http://www.connectionstrings.com/?carrier=sqlserver2005
You may also want to some of the examples such as
http://msdn.microsoft.com/library/d...opi
c.asp
John

Newbie - SqlConnection statement

I'm trying to get a combobox to fill with values from a table. I've
set up an example using the Northwind database with the Categories
table. Dragging in the CategoryID field onto my form as a combobox,
I've set the following properties for the CategoryID combobox:
Value member = "CategoriesBindingSource - CategoryID"
Display Member = "CategoriesBindingSource - CategoryID"
This seems to bring in the correct values in the two non-index fields
(CategoryName and Description). I've then added the following code to
the combobox:
Dim Conn As SqlConnection
Conn = New SqlConnection("Database=Northwnd.mdf")
'Conn.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
CategoryID FROM Categories", Conn)
Dim ds As New DataSet
da.Fill(ds, "Categories")
CategoryIDComboBox.DataSource = ds
'CategoryIDComboBox.ValueMember = "CategoryID"
'CategoryIDComboBox.DisplayMember = "CategoryID"
End Sub
The lines that are commented out are other ideas that I've tried to no
avail. I left them here in case they are relevant.
I suspect that at least part of my problem is in the SqlDataAdapter
statement where I am pointing to the database. I am working on a
standalone pc.
Can anybody see where I am going wrong?
Thanks,
Randy
Hi Randy
"Randy" wrote:

> I'm trying to get a combobox to fill with values from a table. I've
> set up an example using the Northwind database with the Categories
> table. Dragging in the CategoryID field onto my form as a combobox,
> I've set the following properties for the CategoryID combobox:
> Value member = "CategoriesBindingSource - CategoryID"
> Display Member = "CategoriesBindingSource - CategoryID"
> This seems to bring in the correct values in the two non-index fields
> (CategoryName and Description). I've then added the following code to
> the combobox:
> Dim Conn As SqlConnection
> Conn = New SqlConnection("Database=Northwnd.mdf")
> 'Conn.Open()
> Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
> CategoryID FROM Categories", Conn)
> Dim ds As New DataSet
> da.Fill(ds, "Categories")
> CategoryIDComboBox.DataSource = ds
> 'CategoryIDComboBox.ValueMember = "CategoryID"
> 'CategoryIDComboBox.DisplayMember = "CategoryID"
> End Sub
> The lines that are commented out are other ideas that I've tried to no
> avail. I left them here in case they are relevant.
> I suspect that at least part of my problem is in the SqlDataAdapter
> statement where I am pointing to the database. I am working on a
> standalone pc.
> Can anybody see where I am going wrong?
> Thanks,
> Randy
>
For connection string information check out
http://www.connectionstrings.com/?carrier=sqlserver2005
You may also want to some of the examples such as
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlconnectionclasstopic.as p[/url]
John

Newbie - SqlConnection statement

I'm trying to get a combobox to fill with values from a table. I've
set up an example using the Northwind database with the Categories
table. Dragging in the CategoryID field onto my form as a combobox,
I've set the following properties for the CategoryID combobox:
Value member = "CategoriesBindingSource - CategoryID"
Display Member = "CategoriesBindingSource - CategoryID"
This seems to bring in the correct values in the two non-index fields
(CategoryName and Description). I've then added the following code to
the combobox:
Dim Conn As SqlConnection
Conn = New SqlConnection("Database=Northwnd.mdf")
'Conn.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
CategoryID FROM Categories", Conn)
Dim ds As New DataSet
da.Fill(ds, "Categories")
CategoryIDComboBox.DataSource = ds
'CategoryIDComboBox.ValueMember = "CategoryID"
'CategoryIDComboBox.DisplayMember = "CategoryID"
End Sub
The lines that are commented out are other ideas that I've tried to no
avail. I left them here in case they are relevant.
I suspect that at least part of my problem is in the SqlDataAdapter
statement where I am pointing to the database. I am working on a
standalone pc.
Can anybody see where I am going wrong?
Thanks,
RandyHi Randy
"Randy" wrote:
> I'm trying to get a combobox to fill with values from a table. I've
> set up an example using the Northwind database with the Categories
> table. Dragging in the CategoryID field onto my form as a combobox,
> I've set the following properties for the CategoryID combobox:
> Value member = "CategoriesBindingSource - CategoryID"
> Display Member = "CategoriesBindingSource - CategoryID"
> This seems to bring in the correct values in the two non-index fields
> (CategoryName and Description). I've then added the following code to
> the combobox:
> Dim Conn As SqlConnection
> Conn = New SqlConnection("Database=Northwnd.mdf")
> 'Conn.Open()
> Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT
> CategoryID FROM Categories", Conn)
> Dim ds As New DataSet
> da.Fill(ds, "Categories")
> CategoryIDComboBox.DataSource = ds
> 'CategoryIDComboBox.ValueMember = "CategoryID"
> 'CategoryIDComboBox.DisplayMember = "CategoryID"
> End Sub
> The lines that are commented out are other ideas that I've tried to no
> avail. I left them here in case they are relevant.
> I suspect that at least part of my problem is in the SqlDataAdapter
> statement where I am pointing to the database. I am working on a
> standalone pc.
> Can anybody see where I am going wrong?
> Thanks,
> Randy
>
For connection string information check out
http://www.connectionstrings.com/?carrier=sqlserver2005
You may also want to some of the examples such as
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlconnectionclasstopic.asp
John