PC Review


Reply
Thread Tools Rate Thread

'adding' to DB table

 
 
Ken Foskey
Guest
Posts: n/a
 
      3rd Jul 2008

I am brand new to coding C# and Visual Studio.

I have worked out how to configure the ComboBox creating my own object
however it leave me with a lot of management updating as the table
changes.

I would like to add to the table, so if you think sport, a game is
played in a stadium that is located in a country.

game has one venue has one country

I would like to display in the combo box the:
"game description - venue (Country)"
I have done this with a loop and building an but then I loose the
connection between the game datasource when I change the drop box. I
would like to add this description to the table somehow.

I would also like to add the country to the game so that it is all on one
datasource to make the whole linking process easier. Venues are
obviously pretty static.

I have tried to find something with google but cannot find the wood for
the trees.

Can someone please help / point me to a description.

Ta
Ken
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      4th Jul 2008
I really don't understand the description of your problem. Could you post
your code so we can see what you're doing?


"Ken Foskey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I am brand new to coding C# and Visual Studio.
>
> I have worked out how to configure the ComboBox creating my own object
> however it leave me with a lot of management updating as the table
> changes.
>
> I would like to add to the table, so if you think sport, a game is
> played in a stadium that is located in a country.
>
> game has one venue has one country
>
> I would like to display in the combo box the:
> "game description - venue (Country)"
> I have done this with a loop and building an but then I loose the
> connection between the game datasource when I change the drop box. I
> would like to add this description to the table somehow.
>
> I would also like to add the country to the game so that it is all on one
> datasource to make the whole linking process easier. Venues are
> obviously pretty static.
>
> I have tried to find something with google but cannot find the wood for
> the trees.
>
> Can someone please help / point me to a description.
>
> Ta
> Ken



 
Reply With Quote
 
Ken Foskey
Guest
Posts: n/a
 
      4th Jul 2008

I don't understand how to get to the code. When I select the 'game'
datasource, I want ComboSelect comes up as a field I can use to populate
the ComboBox. ComboSelect looks something like this:

String ComboSelect
{
get {
read venue using this.venuecode, get venuedesc and countrycode;
read country using countrycode returning countrydesc;
return formatted( "{0} ({1}) - {2}", this.description,
venudesc, countrydesc);
}
}

I have the actual pseudo code working to do the above, I want to add the
method to the actual game object.

datasource game is derived from an access table automatically by adding a
datasource. How do I extend 'game' to add the extra fields. I can then
use the new improved description in my combo box automatically.

Ta
Ken
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      4th Jul 2008
This still doesn't tell us anything about your problem. If you don't know
how to even see your own code, how can we help you with it?


"Ken Foskey" <(E-Mail Removed)> wrote in message
news:486d6c1f$(E-Mail Removed)...
>
> I don't understand how to get to the code. When I select the 'game'
> datasource, I want ComboSelect comes up as a field I can use to populate
> the ComboBox. ComboSelect looks something like this:
>
> String ComboSelect
> {
> get {
> read venue using this.venuecode, get venuedesc and countrycode;
> read country using countrycode returning countrydesc;
> return formatted( "{0} ({1}) - {2}", this.description,
> venudesc, countrydesc);
> }
> }
>
> I have the actual pseudo code working to do the above, I want to add the
> method to the actual game object.
>
> datasource game is derived from an access table automatically by adding a
> datasource. How do I extend 'game' to add the extra fields. I can then
> use the new improved description in my combo box automatically.
>
> Ta
> Ken



 
Reply With Quote
 
Jeff Winn
Guest
Posts: n/a
 
      4th Jul 2008
If you're using .NET 2.0 you're probably not showing all the files in the
solution. The designer generated code gets placed into a seperate file now
using the partial class functionality that was introduced with 2.0. Since
you don't know where the code is at, I'm guessing you're using the designer
to hook your control to your data, in which case to see it you're going to
need to do the following:

In solution explorer, click the project you were talking about. Next, you
should see 4 buttons being displayed at the top of the solution explorer,
one of them will be named "Show All Files". Simply click it to view the rest
of the files associated with the project. You should see +s next to your
Form names. If you expand the form where your combobox is at, you'll see a
<form>.designer.cs file in there. That's where the code will be at that is
being used to populate the data.

Also, about the designer files - they get generated quite frequently so it's
best to leave the code in there alone.

"I have worked out how to configure the ComboBox creating my own object
however it leave me with a lot of management updating as the table
changes."

Using an ORM tool such as LINQ to SQL might help alleviate those headaches
for you - however depending on your skill level you might spend more time
learning it and forget what you were working on to begin with.

"Ken Foskey" <(E-Mail Removed)> wrote in message
news:486d6c1f$(E-Mail Removed)...
>
> I don't understand how to get to the code. When I select the 'game'
> datasource, I want ComboSelect comes up as a field I can use to populate
> the ComboBox. ComboSelect looks something like this:
>
> String ComboSelect
> {
> get {
> read venue using this.venuecode, get venuedesc and countrycode;
> read country using countrycode returning countrydesc;
> return formatted( "{0} ({1}) - {2}", this.description,
> venudesc, countrydesc);
> }
> }
>
> I have the actual pseudo code working to do the above, I want to add the
> method to the actual game object.
>
> datasource game is derived from an access table automatically by adding a
> datasource. How do I extend 'game' to add the extra fields. I can then
> use the new improved description in my combo box automatically.
>
> Ta
> Ken


 
Reply With Quote
 
Ken
Guest
Posts: n/a
 
      4th Jul 2008
On Fri, 04 Jul 2008 00:53:20 -0400, Scott M. wrote:

> This still doesn't tell us anything about your problem. If you don't
> know how to even see your own code, how can we help you with it?
>
>
> "Ken Foskey" <(E-Mail Removed)> wrote in message
> news:486d6c1f$(E-Mail Removed)...
>>
>> I don't understand how to get to the code. When I select the 'game'
>> datasource, I want ComboSelect comes up as a field I can use to
>> populate the ComboBox. ComboSelect looks something like this:
>>
>> String ComboSelect
>> {
>> get {
>> read venue using this.venuecode, get venuedesc and countrycode;
>> read country using countrycode returning countrydesc; return
>> formatted( "{0} ({1}) - {2}", this.description,
>> venudesc, countrydesc);
>> }
>> }
>>
>> I have the actual pseudo code working to do the above, I want to add
>> the method to the actual game object.
>>
>> datasource game is derived from an access table automatically by adding
>> a datasource. How do I extend 'game' to add the extra fields. I can
>> then use the new improved description in my combo box automatically.
>>
>> Ta
>> Ken



Here is the code. Not sure how it will help you:

I would like to NOT create a separate class but add a column to the match
table creating calculated column then I can simply use the values in a
combobox rather than building a separate set of objects manually.



/// <summary>
/// Display class for the Match selection dialogue
/// </summary>
internal class MatchSelect
{
private int matchId;
private int country;
/// <summary>
/// Numeric Match ID
/// </summary>
public int Id
{
get { return this.matchId; }
}
/// <summary>
/// Numeric Country code
/// </summary>
public int Country
{
get { return this.country; }
}
private StringBuilder display;
internal MatchSelect(CaptureMatch form, int id, String matchDesc,
int venue, int competition )
{
String ven;
matchId = id;
cricdet2000DataSet.tblVenueRow row =
form.cricdet2000DataSet.tblVenue.FindByID(venue);
if (row == null)
{
country = 0;
ven = "Unknown";
}
else
{
country = row.Country;
ven = row.Title;
}
cricdet2000DataSet.tblCompetitionRow row2 =
form.cricdet2000DataSet.tblCompetition.FindByID(competition);
String venueComp;
if (row2 == null)
{
venueComp = "Unknown comp";
}
else
{
venueComp = row2.Title;
}
display = new StringBuilder("");
display.AppendFormat("{0} ({1}) * {2}", matchDesc, ven,
venueComp);
}

/// <summary>
/// Match description as 'match (venue) - competition' for combo
box
/// </summary>
/// <returns> String match (venue) - competition</returns>
public override String ToString()
{
return display.ToString();
}
}
 
Reply With Quote
 
Ken Foskey
Guest
Posts: n/a
 
      6th Jul 2008
On Fri, 04 Jul 2008 01:13:48 -0400, Jeff Winn wrote:

> Using an ORM tool such as LINQ to SQL might help alleviate those
> headaches for you - however depending on your skill level you might
> spend more time learning it and forget what you were working on to begin
> with.



I have to say I am already doing that.

I don't want to hack it so that it works, that would leave an
unsupportable mess.

Ta
Ken
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding my own rows to a Union Query without adding another table? PaulSchrum Microsoft Access Queries 3 15th Feb 2011 08:28 PM
Adding detail to record in a table in a secondary table ramudo Microsoft Access 1 16th Jan 2010 12:32 AM
Adding data from linked table and regular table to a form Mishanya Microsoft Access Getting Started 0 7th Sep 2008 12:48 AM
Make-Table query - Adding table description DK Microsoft Access Queries 0 29th Apr 2004 12:06 PM
Access to onclick events of button controls within dynamically created table + adding linked image to table cell Hrvoje Vrbanc Microsoft ASP .NET 0 11th Mar 2004 03:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:53 AM.