Click here to Skip to main content
15,914,416 members
Home / Discussions / C#
   

C#

 
QuestionProblem parsing rss feed Pin
Member 1022623016-Mar-15 19:25
Member 1022623016-Mar-15 19:25 
AnswerRe: Problem parsing rss feed Pin
Pete O'Hanlon16-Mar-15 22:19
mvePete O'Hanlon16-Mar-15 22:19 
QuestionHow to call protected override void OnPaint(PaintEventArgs e) in another method in C# Pin
Member 1068390216-Mar-15 8:47
Member 1068390216-Mar-15 8:47 
AnswerRe: How to call protected override void OnPaint(PaintEventArgs e) in another method in C# Pin
Eddy Vluggen16-Mar-15 9:08
professionalEddy Vluggen16-Mar-15 9:08 
GeneralRe: How to call protected override void OnPaint(PaintEventArgs e) in another method in C# Pin
Member 1068390216-Mar-15 9:48
Member 1068390216-Mar-15 9:48 
Questionask about windorms and containers Pin
fsdsc216-Mar-15 4:56
fsdsc216-Mar-15 4:56 
AnswerRe: ask about windorms and containers Pin
OriginalGriff16-Mar-15 5:04
mveOriginalGriff16-Mar-15 5:04 
GeneralRe: ask about windorms and containers Pin
fsdsc216-Mar-15 11:21
fsdsc216-Mar-15 11:21 
GeneralRe: ask about windorms and containers Pin
fsdsc217-Mar-15 9:12
fsdsc217-Mar-15 9:12 
Questioncreate PPPoe connection in c# Pin
KARFER16-Mar-15 4:38
KARFER16-Mar-15 4:38 
AnswerRe: create PPPoe connection in c# Pin
OriginalGriff16-Mar-15 5:05
mveOriginalGriff16-Mar-15 5:05 
QuestionDoubt about netinventory Pin
Raghuraman.tm1916-Mar-15 1:32
professionalRaghuraman.tm1916-Mar-15 1:32 
AnswerRe: Doubt about netinventory Pin
OriginalGriff16-Mar-15 2:18
mveOriginalGriff16-Mar-15 2:18 
Questionwriting XML document in C# Pin
Member 436171315-Mar-15 22:03
Member 436171315-Mar-15 22:03 
AnswerRe: writing XML document in C# Pin
manchanx15-Mar-15 22:22
professionalmanchanx15-Mar-15 22:22 
AnswerRe: writing XML document in C# Pin
Eddy Vluggen16-Mar-15 1:28
professionalEddy Vluggen16-Mar-15 1:28 
AnswerRe: writing XML document in C# Pin
amagitech16-Mar-15 6:21
amagitech16-Mar-15 6:21 
AnswerRe: writing XML document in C# Pin
Gerry Schmitz16-Mar-15 12:55
mveGerry Schmitz16-Mar-15 12:55 
AnswerRe: writing XML document in C# Pin
Subramanyam Shankar16-Mar-15 15:33
professionalSubramanyam Shankar16-Mar-15 15:33 
QuestionExport SQL Server Data to Excel Using C#? Pin
OldZero15-Mar-15 17:18
OldZero15-Mar-15 17:18 
I'm working on an assignment that requires a simple data transfer data of a SQL Server to MS Excel; using C#. I was able to develop the "foundation" of what I believe works/ However I'm unable to run the program. Assistance is appreciated!

namespace ProjectLab1
{
    class Program
    {
        static void Main(string[] args)
        {
            //Connection string needed to talk to Omnymbus
            string conString = "Driver={MySQL ODBC 5.3 ANSI Driver};"
                + "Server=devry.edupe.net;Port=4300;"
                + "Database=Inventory_XXXX;"
                + "uid=XXXX;pwd=DeVry_Student";
            OdbcConnection connection = new OdbcConnection(conString);
            connection.Open();
            //Get all data
            //string theQuery = "SELECT * FROM item";
            string theQuery = "SELECT * FROM item i, inventory v where i.invent_id=v.invent_id";
            OdbcDataAdapter DataAdapter = new OdbcDataAdapter(theQuery, connection);
            DataSet theData = new DataSet();
            DataAdapter.Fill(theData, "item");
            DataTable theTable = theData.Tables[0];

            Console.Write("ITEM".PadRight(30));
            Console.Write("QUANT".PadLeft(10));
            Console.Write("SIZE".PadLeft(10));
            Console.Write("COLOR".PadLeft(10));
            Console.Write("PRICE\n".PadLeft(10));//the "\n" moves cursor to next line
            Console.WriteLine("-".PadLeft(70, '-'));// "WriteLine" places cursor next line

            // Loop through all data results
            foreach (DataRow dataRow in theTable.Rows)
            {
                Console.Write(dataRow["invent_desc"].ToString().PadRight(30));
                Console.Write(dataRow["qoh"].ToString().PadLeft(10));
                Console.Write(dataRow["itemsize"].ToString().PadLeft(10));
                Console.Write(dataRow["color"].ToString().PadLeft(10));
                Console.WriteLine(((decimal)dataRow["curr_price"]).ToString("C").PadLeft(10));

            }

            {



                StreamWriter file = new StreamWriter(@"C:\Users\redfaction\Desktop\Data\" + strFileName);
                file.WriteLine(sb.ToString());
                File.Close();
                connection.Close(); // Close connection

                //Have program pause to keep from closing console window



            }
        }
    }
}


modified 17-Mar-15 4:58am.

AnswerRe: Export SQL Server Data to Excel Using C#? Pin
Richard Andrew x6415-Mar-15 17:41
professionalRichard Andrew x6415-Mar-15 17:41 
GeneralRe: Export SQL Server Data to Excel Using C#? Pin
OldZero15-Mar-15 23:32
OldZero15-Mar-15 23:32 
GeneralRe: Export SQL Server Data to Excel Using C#? Pin
Subramanyam Shankar16-Mar-15 15:38
professionalSubramanyam Shankar16-Mar-15 15:38 
GeneralRe: Export SQL Server Data to Excel Using C#? Pin
OldZero16-Mar-15 22:17
OldZero16-Mar-15 22:17 
GeneralRe: Export SQL Server Data to Excel Using C#? Pin
Pete O'Hanlon16-Mar-15 22:22
mvePete O'Hanlon16-Mar-15 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.