473,322 Members | 1,719 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,322 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 1664
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.