|
thank you very much
Sarfarj Ahmed
|
|
|
|
|
i have not read you last post. from this one if I understood you correct,
DateTime current = DateTime.Now;
Timespan t = current.Subtract(inputDate );
The timespan object will have the difference. i.e. re.TotalHours will have the hour difference.
|
|
|
|
|
Thank You very much
your code does make sense.
Could you please tell me a bit detail
1. You are right, input is coming from customer
2. If I substract the input then do I need to specifie any format ex. 10/02/09 5:47
Sarfarj Ahmed
|
|
|
|
|
Convert.ToDateTime uses the current culture. If you want to do culture specific stuff then u wud have to use DateTime.Parse passing it the culture.
|
|
|
|
|
is their anything i can to calculate difrence only hour, eg:
1. 60 hours
2. Not 2 Days and 12 hours
Sarfarj Ahmed
|
|
|
|
|
Timespan's TotalHours property does give you the total difference of hours ?
|
|
|
|
|
I have some files saved in a folder that I need to insert into a 2000 server. Can someone please help me with code for 2003.
I can't use the HtmlInputFile control
|
|
|
|
|
Anita_Kamat_inds wrote: I can't use the HtmlInputFile control
There is no other possibilities. ASP.NET can't read the folder and put files to DB.
|
|
|
|
|
well I used this and it works.
string sFilePath = @"C:\FF73JJ0000.tif";
byte[] bFile = new byte[fs.Length];
fs.Read(bFile, 0, bFile.Length);
SqlConnection connection = new SqlConnection(connectionString);
connection.Open ();
SqlCommand cmd = new SqlCommand ("insert into tblViewContracts "
+ "(ViewImage) values (@pic)", connection);
cmd.Parameters.Add ("@pic", bFile);
this kinds of works.
|
|
|
|
|
Yeah. So the folder will be on server?
|
|
|
|
|
|
Ok. I was thinking the folder is on client. BTW, what is the issue you are facing? You said the code provided is working.
|
|
|
|
|
yeah, at that time I needed help. I got it now. thanks man for atleast responding. if you don't mind can you tell me if a asp.net application application is accessing file on a server, is there a particular user that needs access too the server.
|
|
|
|
|
Anita_Kamat_inds wrote: is there a particular user that needs access too the server.
Usually ASP.NET user account will have read/write access in the website area. If not, it can be granted from the Properties window of that directory. Code accessing C:\SomeFolder may fail as ASP.NET will not have access to directories outside website area.
|
|
|
|
|
Hello Everybody
I want to compare date and time from two diffrent object
Example:
lblSystemDateTime = 10/02/2009 03:37:25
lblSelctedDateTime = 10/02/2009 14:30:00
I want to check wheather SelectedDateTime is 12 hours more than SystemDateTime
How can I check it.
Thanks
Sarfaraj
Sarfarj Ahmed
|
|
|
|
|
|
Actualy I want to calculate wheather customer date and time (input from customer) is 8 hours more than system date and time or not.
Anyway, Thank you very much for replying
Sarfarj Ahmed
|
|
|
|
|
DateTime Dt= DateTime.Parse("10/02/2009 03:37:25");
DateTime Dt2 = DateTime.Parse("10/02/2009 14:30:00");
TimeSpan t = Dt.Subtract(Dt2);
MessageBox.Show(t.TotalHours.ToString());
Now From Time Span you can get the time Difference
|
|
|
|
|
Dear Abhijit Jana
Thanks you very much.
You are a STAR
Thanks
Sarfaraj
Sarfarj Ahmed
|
|
|
|
|
It looks like the date OP is talking about is in dd/mm/yyyy format. If yes, your code will fail. It will take 02 as date and 10 as month. You need to use DateTime.ParseExact with an invariant culture and required format.
|
|
|
|
|
Hi all, somebody knows how create a array multi-dimensional with session variables.
I have it:
Session("Preguntas") = LPH.ObtenerTest(Session("Articulo"), Session("Nivel"))
where it session is a table and I want to add the result of client into other session array but with 2 columns, something similar to
Session("ArrayRespuestas")(Session("i"), 1) = "1" .
I use session variable because when the user make click into button I receive a postback and lost my original select (LPH.ObtenerTest(Session("Articulo"), Session("Nivel"))) that is a procedure that return a select random with 2 parameters.
If I use
If Not Me.Page.IsPostBack Then and put my select into later (the second page_load) doesn't load my select and when I call to
Preguntas.Rows(i)("Respuesta1") I received a error where told me that I must first create a object.
Thanks for all.
|
|
|
|
|
The below code allows a multi-dimensional array to be stored in the session state. See if you can adapt this to fit your use. Good luck.
private void StoreToSession()
{
string[,]initialArray={"A","B"};
Session["sessionvalue"]=initialArray;
}
private void ReteriveFromSession()
{
string[,]resultantArray=(string[,])Session["sessionvalue"];
TextBox1.Text=resultantArray[0,0].ToString();
TextBox2.Text=resultantArray[0,1].ToString();
}
Ranjit Viswakumar
Professional Services Specialist
http://hostmysite.com/?utm_source=bb
|
|
|
|
|
Doesn't work because the postback empty my array when I push btton.
I have when load the first ask (is a test of 25 ask):
Public Ar1(25, 1) As Integer
Procedure of load ask
Ar1(Session("i"), 0) = Session("Preguntas").Rows(Session("i"))("Id_Pregunta")
Session("ArrayRespuestas") = Ar1
later when button_onclick:
Dim respuesta As Integer
If RadioButton1.Checked = True Then respuesta = 1
If RadioButton2.Checked = True Then respuesta = 2
If RadioButton3.Checked = True Then respuesta = 3
If RadioButton4.Checked = True Then respuesta = 4
If RadioButton5.Checked = True Then respuesta = 5
Ar1(Session("i"), 1) = respuesta
Session("ArrayRespuestas") = Ar1
Session("i") = Session("i") + 1
This work without errors, but when I try to recovery the datas of array I only get the value present Ar1(Session("i"), 1) but I lost the value Ar1(Session("i"), 0) because was added before of push button and later the postback empty my array.
Good, realty is when I put Session("ArrayRespuestas") = Ar1 is when I clear my session array.
I believe that the solve is to search like get not postback when click button.
I accept advisers boys
|
|
|
|
|
Solved
I put into page_load
If Not Me.Page.IsPostBack Then
Session("i") = 0
Dim Ar1(25, 1) As Integer
Session("ArrayRespuestas") = Ar1
End If
Then only I define the array a time
Thanks for your help
|
|
|
|
|
Hi,
my page postbacks many times and this button click occurs in between postbacks(one postback occurs due to button click).
when a particular button is clicked for the first time, a snippet will be executed and for other clicks of same button 'this' snippet should not be executed but some other code should be executed and for all clicks(including first click) it should remember(append the values to gridview) the previous values selected.
how can i achieve this senerio. IsPostBack is not applicable. Is there anyway to check clicks and save values in gridview (gridview is not in stored in DB)..
hope i am clear.. any doubts on my question are welcome....
Thanks in advance
|
|
|
|