|
-
Mar 23rd, 2007, 11:18 PM
#1
Thread Starter
Addicted Member
RESOLVED [VS 2005]- asp.net 2.0 data binding help
Hello. I'm trying to learn asp.net 2.0. i just started last week. i was wondering if someone can help me with data binding. I've have a hard time transitioning from vb6 to asp.net 2.0. I hope you guys can help me on this simple problem of mine.
I use sql server 2000 as my database. Below are my tables and questions.
My Tables:
Code:
tblStudent
StudentID bigint
StudentName varchar
CourseID bigint
tblCourse
CourseID bigint
CourseTitle varchar
Typical asp.net 2.0 data binding in Gridview
StudentID StudentName CourseID
100001 George Washington 100
100002 Jose Rizal 101
100003 John Doe 102
100004 Albert Einstein 103
What I wanted to show in Gridview (select, insert, update, delete enabled)
StudentID StudentName CourseTitle
100001 George Washington Engineering
100002 Jose Rizal Management
100003 John Doe Criminology
100004 Albert Einstein Nuclear Physics
I know this is very trivial to some of you guys. I was experimenting with the databinding technique of vs 2005 but got lost when i tried to inner join the tblCourse with tblStudent. I wanted to edit the template for field [CourseID] into a drop down list in edit/add mode so that i can choose freely a course title item and update the tblStudent table. Is there a way to this with databinding? Can I have my ddl show CourseTitle in the list items and post the CourseID as value into tblstudent? or do i have to do it manually in code? any help will be very appreciated. thanks.
Last edited by coolwater; Mar 26th, 2007 at 01:30 AM.
-
Mar 25th, 2007, 06:41 AM
#2
Re: [VS 2005]- asp.net 2.0 data binding help
To start with, look at this tutorial
http://quickstarts.asp.net/QuickStar.../gridview.aspx
For the gridview. It also shows you how to use the sqldatasource with your gridview. For you, then, it's only a matter of writing the correct SQL statement, be it inline or in your stored procedure. (I would recommend stored procedures).
Code:
SELECT S.StudentID, S.StudentName, C.CourseTitle FROM tblStudent S LEFT JOIN tblCourse C ON C.CourseID = S.CourseID
-
Mar 26th, 2007, 01:29 AM
#3
Thread Starter
Addicted Member
Re: [VS 2005]- asp.net 2.0 data binding help
-
Mar 27th, 2007, 05:24 AM
#4
Re: RESOLVED [VS 2005]- asp.net 2.0 data binding help
No problem.
Also, go through a quick SQL tutorial on www.w3schools.com/sql
It'll help in the long run.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|