473,396 Members | 1,892 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,396 software developers and data experts.

RE: Newly getting started in C#

Please go to http://www.a2zdotnet.com/Default.aspx
for step by step tutorials for beginers in ADO.Net sections.

--
regards,
Pankaj
http://www.A2ZDotNet.com
"George" wrote:
hi all,

I am trying to make the jump from VB6 to C#. While I do have a couple of
books, the best way I can learn something is to write something I know. So
please forgive me in advance if this question sounds a bit off in the C#
terminology.

I am taking a simple thing like opening a MS Access database and filling a
listbox with names from 1 of the tables in the database.

I am using Visual Studio 2005 and I created a new project with 1 mdi form.

In VB I would create the connection to the database and connect to it in the
startup module (sub main). Then when needed in the program I would pass the
sql statement to a public subroutine to open the recordset, retrieve the
records and close the recordset.

While I believe I have the correct coding to connect to the database, open a
table, retrieve the needed field/column and then close the table for C#, I
cannot figure out where the best places are for the routines to go. Would I
put the connection routine in the program.cs module? I see that this has
been created in the program.cs module:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new MDIMain());
}

so I was guessing that I could do a:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new MDIMain());
ConnectToDatabase():
}

for my initial connection and have the routine ConnectToDatabase() in the
program.cs module.

The next question would be where do I put a "ExtractRecords" routine so that
all of the forms in the program could access the routine and extract from the
database? Would that go in the program.cs module as well?

Thank you for your support,

George
Aug 11 '08 #1
0 1022

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
84
by: Bibby | last post by:
Hi, I'm interested in getting started in the programming world. I've dabbled in C, C++ and VB6. Which would be the best language to focus my attention to regarding the following considerations: ...
2
by: karl | last post by:
I have a windows service that kicks off a 'monitor' thread which in turn kicks off 4 additional threads. These 4 threads basically are listen on a designated socket and report back any errors...
4
by: mcwooq | last post by:
Hi, I just installed the VS.Studio 2005 Team Edition for Developper and encountered severe problems with debugging ASP.NET 2.0 projects. Even newly empty created ASP 2.0 projects can't debug...
6
by: Jack Duijf | last post by:
Hello, I am looking for a person in The Netherlands that is willing to help me getting started with Vb.net. Please send a message to jack@aicn.nl if you can help me getting started with the...
4
by: Edward Lorden | last post by:
I created a new website, using the ASP .NET Website template. Before I did anything, I tried running it in debug mode. This worked, giving a blank page. I then moved the site to become the...
0
by: Bob | last post by:
I got a 2datagridviews bound to sql serve tables , one parent one child. The changes are always made only to the child table (add, edit or delete) In the Child table definition in SQL server I have...
2
by: OceanBreeze | last post by:
I am using ASP.Net 2.0 and C# and new to this. I have programmatically added a zip code drop down into web form inside Page_Load method as: ZipDropDown.Items.Add("11111");...
1
by: =?Utf-8?B?Q29kZVNsaW5nZXI=?= | last post by:
I plan to build my own 2008 Server/Hyper-V system and will not be using one of the tested Dell or HP systems from the release notes and could use some pointers as to my assumnptions and answers to...
22
by: DL | last post by:
Hi, What I wanted to do is to call a function from a newly created element. But it stumbled me. Here's the line that references the newly created element and I used the alert function for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.