By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,567 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,567 IT Pros & Developers. It's quick & easy.

'adding' to DB table

P: n/a

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
Jul 3 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <fo****@optushome.com.auwrote in message
news:48******@dnews.tpgi.com.au...
>
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

Jul 3 '08 #2

P: n/a

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
Jul 4 '08 #3

P: n/a
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" <fo****@optushome.com.auwrote in message
news:48********@dnews.tpgi.com.au...
>
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

Jul 4 '08 #4

P: n/a
Ken
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" <fo****@optushome.com.auwrote in message
news:48********@dnews.tpgi.com.au...
>>
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(co mpetition);
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>
/// <returnsString match (venue) - competition</returns>
public override String ToString()
{
return display.ToString();
}
}
Jul 4 '08 #5

P: n/a
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" <fo****@optushome.com.auwrote in message
news:48********@dnews.tpgi.com.au...
>
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
Jul 4 '08 #6

P: n/a
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
Jul 6 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.