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. |
This is a discussion on c# within the C# forums, part of the Software Development category; a c# program to get the following output * ** *** **** *****...
|
|||||||
|
|||
|
c#
a c# program to get the following output
* ** *** **** ***** |
| The Following 3 Users Say Thank You to resh_c For This Useful Post: | ||
| Sponsored Links |
|
|||
|
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(); } } } |
|
|||
|
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 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|