-
Junior Member
c#
a c# program to get the following output
*
**
***
****
*****
-
Junior Member
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();
}
}
}
-
Junior Member
Re: c#
how to upload a file using console application?
-
Junior Member
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
-
Forum Rules