473,390 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

'adding' to DB table


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
6 1667
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

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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
5
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new...
2
by: Chris Cobb | last post by:
I have a table that currently contains 718000 rows. I wish to add a column to the table. Adding this column anywhere other than the end of the table requires exporting data, a drop and recreate,...
3
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are:...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
0
by: Sileesh | last post by:
Hi I have html table and a Button in an Aspx page. I am adding one row with some textboxes to Html table each time i click on the Button thru Javascript. Now problem is when when i try to...
0
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.