Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,158 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,111 people online right now. Registration is fast and FREE... Join Now!




New to C# programming

 
Reply to this topicStart new topic

New to C# programming, Hi i copied my code bekiw my problem is where can i write that code in

mohanallam
6 Dec, 2007 - 01:44 AM
Post #1

New D.I.C Head
*

Joined: 6 Dec, 2007
Posts: 1


My Contributions
CODE
using System;
using System.Data;
using System.Data.SqlClient;

class SqlConnectionDemo
{
    static void Main()
    {
             SqlConnection conn = new SqlConnection(
            "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

        SqlDataReader rdr = null;

        try
        {
                       conn.Open();

                       SqlCommand cmd = new SqlCommand("select * from Customers", conn);

                      rdr = cmd.ExecuteReader();

                    while (rdr.Read())
            {
                Console.WriteLine(rdr[0]);
            }
        }
        finally
        {
                       if (rdr != null)
            {
                rdr.Close();
            }

                     if (conn != null)
            {
                conn.Close();
            }
        }
    }
}

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: New To C# Programming
6 Dec, 2007 - 12:01 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,199



Thanked: 213 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Welcome to Dream.In.Code mohanallam! This forum is for meeting other people and not exactly designed for answering C# questions. You might be better off trying out the C# forum where you can get answers in a more timely manner and their answers will be more accurate too! So feel free to ask there and we ask that you be patient in waiting for a reply, a lot of DIC members are helping others in various forums.

Thanks and welcome to the board! smile.gif
User is online!Profile CardPM
+Quote Post

nirvanarupali
RE: New To C# Programming
7 Dec, 2007 - 12:57 AM
Post #3

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
As Martyr2 said, post in the right forum. An next time

code.gif

welcome to </dic>. smile.gif
User is offlineProfile CardPM
+Quote Post

Jayman
RE: New To C# Programming
7 Dec, 2007 - 07:57 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,926



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Moved to C# forum.
User is offlineProfile CardPM
+Quote Post

baavgai
RE: New To C# Programming
8 Dec, 2007 - 04:45 AM
Post #5

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 2,019



Thanked: 105 times
Dream Kudos: 475
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua

My Contributions
Code looks fine. I'd change the order of stuff a hair, but that's just me being picky.

What's the question?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 11:33PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month