Click here to Skip to main content
15,889,462 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Export SQL Server Data to Excel Using C#? Pin
OldZero16-Mar-15 22:43
OldZero16-Mar-15 22:43 
AnswerRe: Export SQL Server Data to Excel Using C#? Pin
Gerry Schmitz16-Mar-15 14:02
mveGerry Schmitz16-Mar-15 14:02 
Questionhow to open and read .po(translation) file Pin
Member 1140010015-Mar-15 8:07
Member 1140010015-Mar-15 8:07 
AnswerRe: how to open and read .po file Pin
Dave Kreskowiak15-Mar-15 10:01
mveDave Kreskowiak15-Mar-15 10:01 
AnswerRe: how to open and read .po(translation) file Pin
Brisingr Aerowing26-Mar-15 2:40
professionalBrisingr Aerowing26-Mar-15 2:40 
QuestionHow to edit a datagridview/textboxes using tableadapters in c# and sql Pin
Member 1152545314-Mar-15 15:37
Member 1152545314-Mar-15 15:37 
QuestionSaving what items are selected from a listbox. Pin
Chris-222113-Mar-15 17:13
Chris-222113-Mar-15 17:13 
AnswerRe: Saving what items are selected from a listbox. Pin
OriginalGriff14-Mar-15 0:17
mveOriginalGriff14-Mar-15 0:17 
SuggestionRe: Saving what items are selected from a listbox. Pin
Richard Deeming16-Mar-15 2:37
mveRichard Deeming16-Mar-15 2:37 
QuestionSession ended event not properly working Pin
Member 1085025313-Mar-15 11:58
Member 1085025313-Mar-15 11:58 
AnswerRe: Session ended event not properly working Pin
Eddy Vluggen13-Mar-15 12:06
professionalEddy Vluggen13-Mar-15 12:06 
GeneralRe: Session ended event not properly working Pin
Member 1085025313-Mar-15 12:19
Member 1085025313-Mar-15 12:19 

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.