473,719 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column 'link_url' does not belong to table links.

I have a simple Stored Procedure with multiple select statements..doi ng
select * from links for example.
I created a DataTable and then fill the tables
But the first dtTemplate DataTable doesn't give the error but the links
does!
I get the error on this LINE(when looping):-

PageLinks.Text = PageLinks.Text & dtLinks.Rows(iL oop)("link_url" )
cmdAccess.Comma ndType = CommandType.Sto redProcedure
cmdAccess.Comma ndText = "mystocprocedur e"

Dim daTemplate As SqlDataAdapter = New SqlDataAdapter( cmdAccess)
Dim daLinks As SqlDataAdapter = New
SqlDataAdapter( cmdAccess)
Dim daCategory As SqlDataAdapter = New
SqlDataAdapter( cmdAccess)

Dim dsAccess As DataSet = New DataSet
Dim dtTemplate As DataTable = New DataTable
Dim dtLinks As DataTable = New DataTable
Dim dtCategory As DataTable = New DataTable
'filling DataSet with links table
daLinks.Fill(ds Access, "links")
dtLinks = dsAccess.Tables ("links")

dtLinksCount = dtLinks.Rows.Co unt
PageLinks.Text = ""

While iLoop < dtLinksCount
PageLinks.Text = PageLinks.Text & "<a href="
PageLinks.Text = PageLinks.Text &
dtLinks.Rows(iL oop)("link_url" )
PageLinks.Text = PageLinks.Text & ">"
PageLinks.Text = PageLinks.Text &
dtLinks.Rows(iL oop)("link_text ")
PageLinks.Text = PageLinks.Text & "</a>"

If iLoop < dtLinksCount - 1 Then
PageLinks.Text = PageLinks.Text & " | "
End If
System.Math.Min (System.Threadi ng.Interlocked. Increment(iLoop ), iLoop -
1)

End While

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
7 1695
What error do you get?
btw, does the table has that column? Recheck the design..

--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------------

Nov 19 '05 #2
Thx Gaurav for the response!
I get the Error :- Column 'link_url' does not belong to table links
The column exists for sure.

If i do :-

string ssLinks = "Select * From links";
SqlDataAdapter daLinks = new SqlDataAdapter( ssLinks, dcAccess);
DataTable dtLinks = new DataTable();

I get the desired result but when i use stored procedure i get the
error.
I don't want to use string for calling my sql statements.
But i think the problem is that my select satements in the stored
procedure doesn't feed the DataTable correctly
when i LOOP through the records
Any workarounds?


*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3
Hi Patrick,

If your SP has multiple select queries, you don't need to
multi-fill dataset. Only one SqlDataAdapter. Fill(dataset)
call will fill multi-tables in the dataset.

It's similar to following example:

Dim dap As New SqlDataAdapter( "Select * From Table1;
Select * From Table2", CONNECTION_STRI NG)
Dim ds As New DataSet
dap.Fill(ds)

Two datatables are filled to the dataset.

HTH

Elton Wang
el********@hotm ail.com
-----Original Message-----
I have a simple Stored Procedure with multiple select statements..doi ngselect * from links for example.
I created a DataTable and then fill the tables
But the first dtTemplate DataTable doesn't give the error but the linksdoes!
I get the error on this LINE(when looping):-

PageLinks.Te xt = PageLinks.Text & dtLinks.Rows(iL oop) ("link_url")

cmdAccess.Comm andType = CommandType.Sto redProcedure
cmdAccess.Comm andText = "mystocprocedur e"

Dim daTemplate As SqlDataAdapter = New SqlDataAdapter (cmdAccess) Dim daLinks As SqlDataAdapter = New
SqlDataAdapter (cmdAccess)
Dim daCategory As SqlDataAdapter = New
SqlDataAdapter (cmdAccess)

Dim dsAccess As DataSet = New DataSet
Dim dtTemplate As DataTable = New DataTable
Dim dtLinks As DataTable = New DataTable
Dim dtCategory As DataTable = New DataTable
'filling DataSet with links table
daLinks.Fill(ds Access, "links")
dtLinks = dsAccess.Tables ("links")

dtLinksCount = dtLinks.Rows.Co unt
PageLinks.Text = ""

While iLoop < dtLinksCount
PageLinks.Text = PageLinks.Text & "<a href=" PageLinks.Text = PageLinks.Text &
dtLinks.Rows(i Loop)("link_url ")
PageLinks.Text = PageLinks.Text & ">"
PageLinks.Text = PageLinks.Text &
dtLinks.Rows(i Loop)("link_tex t")
PageLinks.Text = PageLinks.Text & "</a>"

If iLoop < dtLinksCount - 1 Then
PageLinks.Text = PageLinks.Text & " | " End If
System.Math.Mi n(System.Thread ing.Interlocked .Increment (iLoop), iLoop -1)

End While

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***.

Nov 19 '05 #4
Thx for the reply Elton

This is what 'm trying to do:-

Tried using one DataAdapter but i still get Error on line:-

PageLinks.Text = PageLinks.Text & dtLinks.Rows(iL oop)("link_url" )
Code below
-------------
Dim cmdAccess As New SqlCommand("web page", dcAccess)
cmdAccess.Comma ndType = CommandType.Sto redProcedure

Dim daTemplate As SqlDataAdapter = New SqlDataAdapter( cmdAccess)

Dim dsAccess As DataSet = New DataSet
Dim dtTemplate As DataTable = New DataTable
Dim dtLinks As DataTable = New DataTable
Dim dtCategory As DataTable = New DataTable
Dim dtPage As DataTable = New DataTable

Dim dtLinksCount As Integer
Dim dtCategoryCount As Integer
dcAccess.Open()
daTemplate.Fill (dsAccess, "templates" )
dtTemplate = dsAccess.Tables ("templates" )

PageHeader.Text =
dtTemplate.Rows (0)("template_h eader").ToStrin g
PageFooter.Text =
dtTemplate.Rows (0)("template_f ooter").ToStrin g

daTemplate.Fill (dsAccess, "links")

dtLinks = dsAccess.Tables ("links")

dtLinksCount = dtLinks.Rows.Co unt
PageLinks.Text = ""
Dim iLoop As Integer
iLoop = 0

'Pulls out the category TOP links from the Database by
looping through dtLinks

While iLoop < dtLinksCount
PageLinks.Text = PageLinks.Text & "<a href="
PageLinks.Text = PageLinks.Text &
dtLinks.Rows(iL oop)("link_url" )
PageLinks.Text = PageLinks.Text & ">"
PageLinks.Text = PageLinks.Text &
dtLinks.Rows(iL oop)("link_text ")
PageLinks.Text = PageLinks.Text & "</a>"

If iLoop < dtLinksCount - 1 Then
PageLinks.Text = PageLinks.Text & " | "
End If
System.Math.Min (System.Threadi ng.Interlocked. Increment(iLoop ), iLoop -
1)

End While

daTemplate.Fill (dsAccess, "category")

dtCategory = dsAccess.Tables ("category")
dtCategoryCount = dtCategory.Rows .Count
PageCategory.Te xt = ""
iLoop = 0

While iLoop < dtCategoryCount
PageCategory.Te xt = PageCategory.Te xt & "<a href="
PageCategory.Te xt = PageCategory.Te xt &
dtCategory.Rows (iLoop)("catego ry_url")
PageCategory.Te xt = PageCategory.Te xt & ">"
PageCategory.Te xt = PageCategory.Te xt &
dtCategory.Rows (iLoop)("catego ry_text")
PageCategory.Te xt = PageCategory.Te xt & "</a><br>"

System.Math.Min (System.Threadi ng.Interlocked. Increment(iLoop ), iLoop -
1)

End While

'Displaying the Category Headers
'daPage.Fill(ds Access, "pages")

daTemplate.Fill (dsAccess, "pages")

dtPage = dsAccess.Tables ("pages")
PageContent.Tex t = ""
PageContent.Tex t = PageContent.Tex t & "<center><b >"
PageContent.Tex t = PageContent.Tex t &
dtPage.Rows(0)( "page_title ")
PageContent.Tex t = PageContent.Tex t & "<br>"
PageContent.Tex t = PageContent.Tex t &
dtPage.Rows(0)( "page_subtitle" )
PageContent.Tex t = PageContent.Tex t & "</b><br></center>"
PageContent.Tex t = PageContent.Tex t &
dtPage.Rows(0)( "page_text" )
If Not (Request.QueryS tring("category ") Is Nothing) Then
Dim ssCatPage As String = "Select page_id, page_title,
page_subtitle From pages Where page_category = " &
Request.QuerySt ring("category" )
Dim daCatPage As SqlDataAdapter = New
SqlDataAdapter( ssCatPage, dcAccess)
Dim dtCatPage As DataTable = New DataTable
Dim dtCatPageCount As Integer

daCatPage.Fill( dsAccess, "catpages")
dtCatPage = dsAccess.Tables ("catpages")
dtCatPageCount = dtCatPage.Rows. Count

iLoop = 0

'Displaying Content in the inner page
While iLoop < dtCatPageCount
PageContent.Tex t = PageContent.Tex t & "<p>"
PageContent.Tex t = PageContent.Tex t & "<a
href=default.as px?page="
PageContent.Tex t = PageContent.Tex t &
dtCatPage.Rows( iLoop)("page_id ")
PageContent.Tex t = PageContent.Tex t & ">"
PageContent.Tex t = PageContent.Tex t &
dtCatPage.Rows( iLoop)("page_ti tle")
PageContent.Tex t = PageContent.Tex t & "</a><br>"
PageContent.Tex t = PageContent.Tex t &
dtCatPage.Rows( iLoop)("page_su btitle")
PageContent.Tex t = PageContent.Tex t & "</p>"

System.Math.Min (System.Threadi ng.Interlocked. Increment(iLoop ), iLoop -
1)
End While
End If

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #5
And Elton the simple store proc looks like this:-
CREATE PROCEDURE dbo.webpage
AS
Select template_id,tem plate_header,te mplate_footer from templates
Select link_id,link_te xt,link_url from links
Select category_id,cat egory_text,cate gory_url from category
Select page_id,page_ca tegory,page_tit le,page_subtitl e,page_text from
pages
RETURN
GO


*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #6
As I mentioned, you only need fill dataset once:

Dim cmdAccess As New SqlCommand("web page", dcAccess)
cmdAccess.Comma ndType = CommandType.Sto redProcedure

Dim daTemplate As SqlDataAdapter = New SqlDataAdapter( cmdAccess)

Dim dsAccess As DataSet = New DataSet
Dim dtTemplate As DataTable = New DataTable
Dim dtLinks As DataTable = New DataTable
Dim dtCategory As DataTable = New DataTable
Dim dtPage As DataTable = New DataTable
daTemplate.Fill (dsAccess)
' It fills templates, links, category, pages datatable in one time
' Then you can refer to these tables by
dtTemplate = dsAccess.Tables (0)
dtTemplate.Tabl eName = "templates"

dtLinks = dsAccess.Tables (1)
dtLinks.TableNa me = "links"

dtCategory = dsAccess.Tables (2)
dtCategory.Tabl eName = "category"

dtPage = dsAccess.Tables (3)
dtPage.TableNam e = "pages"
HTH
"Patrick Olurotimi Ige" wrote:
And Elton the simple store proc looks like this:-
CREATE PROCEDURE dbo.webpage
AS
Select template_id,tem plate_header,te mplate_footer from templates
Select link_id,link_te xt,link_url from links
Select category_id,cat egory_text,cate gory_url from category
Select page_id,page_ca tegory,page_tit le,page_subtitl e,page_text from
pages
RETURN
GO


*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #7
Thx for the reply....
I got it working having each Stored Proc to each DataADapter before.
But with this new trick its cool
Thx Elton
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7547
by: Holmespundit | last post by:
Stylists... I'm having problems collapsing a column. Specifically, I want to collapse the last column of a table. My initial test with a large data set worked, but I cannot make it work with a small example. Here are links to the data files (source included below): http://home.covad.net/~holmespun/20050320_column_visibility_collapse_test.html http://home.covad.net/~holmespun/20050320_column_visibility_collapse_test.css
0
1540
by: mkomasi | last post by:
I am using a datagrid in my form sometimes when a child form of this datagrid form closed an exception like "Column C does not belong to the table T" was thrown. this exception is rarely occured so rarely and I can not find the way that it was generated, so I can not debug the the exception. does anybody know how to generate this exception and how to handle it.
5
8489
by: Kejpa | last post by:
Hi, How do you write a Rowfilter for a boolean column? col1=true col1='true' col1= 1 col1= -1 Will all render an exception: Column 'col1' does not belong to table Test. Any thoughts?
10
2343
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out what column has been clicked. In my testing so far when I use the context menu I always get the...
0
1602
by: Mike | last post by:
We are using .NET 2.0 and intermittently egt the following errors on almost all our web pages. The error is not repoducable and cycling the worker process seems to temporarily fix the problems. Has anyone seen this or have any suggestions? Event code: 3005 Event message: An unhandled exception has occurred. Event time: 9/5/2006 4:23:47 PM Event time (UTC): 9/5/2006 11:23:47 PM Event ID: cb408727296440278fb486579b359b15
4
15285
by: Mike | last post by:
We are using .NET 2.0 and intermittently egt the following errors on almost all our web pages. The error is not repoducable and cycling the worker process seems to temporarily fix the problems. Has anyone seen this or have any suggestions? Event code: 3005 Event message: An unhandled exception has occurred. Event time: 9/5/2006 4:23:47 PM Event time (UTC): 9/5/2006 11:23:47 PM Event ID: cb408727296440278fb486579b359b15
1
2504
by: shil | last post by:
Hi all, updating SQL database with the data.I'm stuck with an issue. One of the XML file from the list don't have a node mentioned. For example almost all XML files structure is like this <treatment_settings> <setup> <product1> <name>PSO-NO2</name>
2
5656
by: Ronald S. Cook | last post by:
In the code below, I get a runtime error where indicated. The error is: "Column 'TICKETNO' does not belong to table TICKET_DEDUCTIONS." If I put a breakpoint on that line (so not yet executed) and type ?dedrow(c), It says basically the same thing: Run-time exception thrown : System.ArgumentException - Column 'TICKETNO' does not belong to table TICKET_DEDUCTIONS.
1
12272
by: majidkorai | last post by:
Hey Guyz I am having problem when i read the data from a datareader into a data table. The whole scenario is this that I want to read data from two diffrent databases, the table strcutre is same. You can say that other one is the copy of 1st one. I want to read out the data from one table in one database and merge the results with the one read form the other database. What i am doing is reading data from two databases into data...
0
8833
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8727
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9365
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9210
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7998
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6661
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3186
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2125
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.