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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving to a Database from a View

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
0
0
US
Hello. I am working on a Visual Basic 2005 Express app with a SQL Server 2005 DB. I have several basic tables in my DB, all containing student data for my school district. I have one table with all of the basic student info, including leave codes, which is a 2 character code that is pretty random (A1, C6, E8, etc). I have another table containing the leave codes as well as a description for each leave code that is linked to the student table by the leave code.


In my app, I have a form with all of the student data and the leave code field is a combobox. I would like the combobox to display the leave code and the code description separated by a hyphen and am not sure the best way to combine the two fields from two tables into a single combobox.

Maybe creating a view would work, but I am not sure if I would be able to save the data back to the student table if I used the view.

I am pretty stuck and not sure as to the best way to accomplish this task. Any help will be appreciated.

Thanks in advance.
 
I would like the combobox to display the leave code and the code description separated by a hyphen
This is a job for SQL.
Code:
Select LeaveCode + '-' + CodeDescription As FullCode
      From ...
      Where ...

Jim
 
Ok.

Would I create that as a view, or a function, etc.

I'm not too sure.

If it is a view, will I be able to save the records from within the app?
 
No not a view, views are not updatable as far as i know.. you write that in your sql statement that retrieves the rows you want to display.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top