Results 1 to 4 of 4

Thread: c#

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Answers
    1

    c#

    a c# program to get the following output
    *
    **
    ***
    ****
    *****


  2. #2
    Junior Member
    Join Date
    Jan 2009
    Answers
    2

    Re: c#

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
    class Star
    {

    public static void WriteMeAStar(int starsToBeWritten)
    {
    for(int i =starsToBeWritten; i>0;i--)
    Console.Write(@"*");
    Console.WriteLine();
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    for (int i = 1; i<=5; i++)
    {
    Star.WriteMeAStar(i);
    }
    Console.Read();
    }
    }
    }


  3. #3
    Junior Member
    Join Date
    Mar 2009
    Answers
    1

    Re: c#

    how to upload a file using console application?


  4. #4
    Junior Member
    Join Date
    Feb 2009
    Answers
    21

    Re: c#

    you can use store procedure in SQL.I hav a sample program in store procedure.When i upload a image it will be store in the Database


    C#

    try
    {
    string sTheName,sDirPath;
    sTheName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName.ToString());
    sDirPath = System.IO.Path.GetDirectoryName(FileUpload1.PostedFile.FileName.ToString());

    SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=nithya;User ID=sa;Password=sa");
    con.Open();
    SqlCommand cmd = new SqlCommand("FileSystemIn", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlParameter pTheName = cmd.Parameters.Add("@TheName", SqlDbType.VarChar, 50);
    pTheName.Direction = ParameterDirection.Input;
    pTheName.Value = sTheName;
    SqlParameter pDirPath = cmd.Parameters.Add("DirPath", SqlDbType.VarChar, 50);
    pDirPath.Direction = ParameterDirection.Input;
    pDirPath.Value = sDirPath;
    cmd.ExecuteNonQuery();
    con.Close();

    }
    catch (Exception ex)
    {
    Response.Write(ex.Message);
    }


    Store procedure

    CREATE PROCEDURE FileSystemIn
    {
    @TheName varchar(50),
    @DirPath varChar(50)
    }
    AS
    INSERT INTO image
    (TheName,DirPath)
    VALUES(@TheName,@DirPath)



    Like thiswise you can upload your filles

    Regards,
    Nithya.R


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact