Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

c#

This is a discussion on c# within the C# forums, part of the Software Development category; a c# program to get the following output * ** *** **** *****...

Go Back   Geeks Talk > Software Development > C#
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-14-2008
Junior Member
 
Join Date: Jul 2008
Location: india
Posts: 1
Thanks: 0
Thanked 3 Times in 1 Post
resh_c is on a distinguished road
c#

a c# program to get the following output
*
**
***
****
*****
Reply With Quote
The Following 3 Users Say Thank You to resh_c For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 01-24-2009
Junior Member
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
rstoilova is on a distinguished road
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();
}
}
}
Reply With Quote
  #3 (permalink)  
Old 03-10-2009
Junior Member
 
Join Date: Mar 2009
Location: chennai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
praveengineer is on a distinguished road
Re: c#

how to upload a file using console application?
Reply With Quote
  #4 (permalink)  
Old 03-13-2009
Junior Member
 
Join Date: Feb 2009
Location: india
Posts: 21
Thanks: 0
Thanked 13 Times in 9 Posts
nithui is on a distinguished road
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
Reply With Quote
Reply

  Geeks Talk > Software Development > C#

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 11:08 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved