Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I switched from Access datab

Status
Not open for further replies.

ncirkel

IS-IT--Management
Sep 28, 2003
10
0
0
NL
Hi,

I switched from Access databases and ASP to sql-server and ASP.NET some time ago and now ran into a little difference. I am not quite sure if the difference is in ASP.NET or in sql-server.

When I open a dataset using a join-query, I am no longer able to refer to columns as in "tablename.columnname". Therefore, if I have a table Countries and a table Cities and they both have a Name column, when I join them together I don't know how to refer to one of them (Countries.Name or Cities.Name returns an error).

How can I do this?

Thanks a lot,
Nander
 
exactly what error message are you getting because that is a correct way to refer to tablename.Fieldname
 
The error message is:

System.ArgumentException: Column 'City.Name' does not belong to table Table

"Table" is the name of the table that holds the query in the dataset.
 
I did some more research. I use Microsoft's SQLHelper class to fill the dataset. It uses the following code to get the queryresults into the dataset:

Code:
                'create the DataAdapter & DataSet
                da = New SqlDataAdapter(cmd)

                'fill the DataSet using default values for DataTable names, etc.
                da.Fill(ds)

Guess that's where the table names are lost, but I can't think of a way to prevent it from doing this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top