Click here to Skip to main content
16,014,300 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionweb deployment in asp.net 2005 Pin
Sonia Gupta30-Jul-07 19:39
Sonia Gupta30-Jul-07 19:39 
AnswerRe: web deployment in asp.net 2005 Pin
N a v a n e e t h30-Jul-07 20:10
N a v a n e e t h30-Jul-07 20:10 
QuestionrRetaining Data in web form after transfer to another form and back Pin
Sakshi Smriti30-Jul-07 18:58
Sakshi Smriti30-Jul-07 18:58 
AnswerRe: rRetaining Data in web form after transfer to another form and back Pin
Christian Graus30-Jul-07 19:08
protectorChristian Graus30-Jul-07 19:08 
QuestionGridView Issue Pin
Brendan Vogt30-Jul-07 18:50
Brendan Vogt30-Jul-07 18:50 
AnswerRe: GridView Issue Pin
Christian Graus30-Jul-07 19:12
protectorChristian Graus30-Jul-07 19:12 
QuestionLock question [modified] Pin
perrin486930-Jul-07 17:26
perrin486930-Jul-07 17:26 
QuestionGetting data from two tables in a repeater Pin
phoeno2930-Jul-07 17:18
phoeno2930-Jul-07 17:18 
Hi,

I am new to asp.net but have learnt a lot through the tutorials and random searching here and elsewhere. Have many years expereince with classic ASP but this task I am working on is sending me around the bend !

I want to have a nested repeater (this bit I understand fine) but am unsure how to make my data from two tables in the one database join together.

I have a table called boatcats which list a few different categoies of boat and I have a second table called 'boats' that list all of the boats and their details. The two tables share boatcats.ID and boats.catid

I doubt my code is heading in the right direction and I am unsure how to link the two queries. I am using VB not C# and should I be doing this sort of thing at code level (which I am used to in asp classic or with Visual Web Developer 2005)

Code so far is....

<script language="vb" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
If Not Page.IsPostBack then
BindData() 'Only bind the data on the first page load
End If
End Sub


Sub BindData()

dim dbconn,strq,dbcomm,dbread

dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("boats.mdb"))
dbconn.Open()
strq = "Select * from boatcats"

dbcomm=New OleDbCommand(strq,dbconn)
dbread=dbcomm.ExecuteReader()
boatcats.DataSource=dbread
boatcats.DataBind()
dbread.Close()
dbconn.Close()

End Sub


Sub BindData2()
dim dbconn2,strq2,dbcomm2,dbread2,boats2

dbconn2=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("boats.mdb"))
dbconn2.Open()
strq2 = "Select * from boats"

dbcomm2=New OleDbCommand(strq2,dbconn2)
dbread2=dbcomm2.ExecuteReader()
boats.DataSource=dbread2
boats.DataBind()
dbread2.Close()
dbconn2.Close()
end sub


</script>


I havn't added the asp:repeater section, this I have no problems with.

Any help appreciated.

Martin
AnswerRe: Getting data from two tables in a repeater Pin
daniel__c30-Jul-07 20:21
daniel__c30-Jul-07 20:21 
GeneralRe: Getting data from two tables in a repeater Pin
phoeno2930-Jul-07 20:40
phoeno2930-Jul-07 20:40 
GeneralRe: Getting data from two tables in a repeater Pin
daniel__c30-Jul-07 20:47
daniel__c30-Jul-07 20:47 
Questionfinding the index of datagrid using the selected item templates Pin
A.Vishal30-Jul-07 15:37
A.Vishal30-Jul-07 15:37 
AnswerRe: finding the index of datagrid using the selected item templates Pin
N a v a n e e t h30-Jul-07 20:06
N a v a n e e t h30-Jul-07 20:06 
GeneralRe: finding the index of datagrid using the selected item templates Pin
A.Vishal1-Aug-07 16:06
A.Vishal1-Aug-07 16:06 
QuestionWhy the exception "Object reference not set to an instance of an object." occurs? Pin
hurrem30-Jul-07 14:41
hurrem30-Jul-07 14:41 
AnswerRe: Why the exception "Object reference not set to an instance of an object." occurs? Pin
Christian Graus30-Jul-07 17:49
protectorChristian Graus30-Jul-07 17:49 
AnswerRe: Why the exception "Object reference not set to an instance of an object." occurs? Pin
daniel__c30-Jul-07 20:34
daniel__c30-Jul-07 20:34 
QuestionWHATS THAT PROBLEMS Pin
Neo_Shehpar30-Jul-07 14:21
Neo_Shehpar30-Jul-07 14:21 
AnswerRe: WHATS THAT PROBLEMS Pin
Christian Graus30-Jul-07 17:48
protectorChristian Graus30-Jul-07 17:48 
GeneralRe: WHATS THAT PROBLEMS [modified] Pin
Neo_Shehpar3-Aug-07 3:17
Neo_Shehpar3-Aug-07 3:17 
QuestionSetting file ContentType dynamically [modified] Pin
ASPnoob30-Jul-07 13:09
ASPnoob30-Jul-07 13:09 
AnswerRe: Setting file ContentType dynamically Pin
Christian Graus30-Jul-07 17:50
protectorChristian Graus30-Jul-07 17:50 
GeneralRe: Setting file ContentType dynamically [modified] Pin
ASPnoob30-Jul-07 19:18
ASPnoob30-Jul-07 19:18 
GeneralRe: Setting file ContentType dynamically Pin
Christian Graus30-Jul-07 19:27
protectorChristian Graus30-Jul-07 19:27 
Questionupdate panel problem Pin
Mogaambo30-Jul-07 12:07
Mogaambo30-Jul-07 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.