|
concatenated three dropdownlists values i inserted year month day into a column in sql table.
how to retrieve that values seperately to that three ddls from sql table
help plz...
for inserting i used....
string str = DropDownList5.SelectedItem.Value.ToString();
string str1 = DropDownList6.SelectedItem.Value.ToString();
string str2 = DropDownList7.SelectedItem.Value.ToString();
string final = str1 + "-" + str + "-" + str2;
cmd.Parameters.Add("@startdate", SqlDbType.SmallDateTime.ToString()).Value = final;
|
|
|
|
|
madhukk wrote: cmd.Parameters.Add("@startdate", SqlDbType.SmallDateTime.ToString()).Value = final;
Try This .
DateTime MyDateTime;
MyDateTime = new DateTime();
MyDateTime = DateTime.ParseExact(final , "yyyy-MM-dd",
null);
cmd.Parameters.Add("@startdate",MyDateTime );
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
im able to insert it..
i want to retrieve startdate column and transfer to other page using session..
using datareader i stored that column in a string
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{ Session["startdate"] = dr["startdate"];
}
in next page to tranfer the value
if i write this
DropDownList1.SelectedItem.Text= Session["startdate"].ToString();
im getting complete date(10/20/2001) in DropDownList1..
but what i want is ddl1(10) ddl2(20) ddl3(2001) as i inserted...
|
|
|
|
|
madhukk wrote: im getting complete date(10/20/2001) in DropDownList1..
Which is exactly what you coded. If you want to separate the values across different drop downs then you need to separate the components of the date. Day to one, month to another, and year to the third. How complicated can this be?
|
|
|
|
|
You need to split them before store.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
thats what im unable to any sample code please..
|
|
|
|
|
madhukk wrote: any sample code please..
One sample code for you.
String DateText="12/10/2009";
String [] DatePart= DateText.Split('/');
string dd=DatePart[0].ToString();
string mm=DatePart[1].ToString();
string yy=DatePart[2].ToString();
Hope you can take it forward. Let me know if any more issue.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I would prefer this one as it does not believe on string manipulatio and when we have datetime datatype then why do string manipulation?
String strDate = "12/27/2009";
String strFormat = "mm/dd/yyyy";
System.Globalization.CultureInfo provider = System.Globalization.CultureInfo.InvariantCulture;
DateTime dt = DateTime.ParseExact(strDate, strFormat, provider);
String dd = dt.Day.ToString();
String mm = dt.Month.ToString();
String yyyy = dt.Year.ToString();
|
|
|
|
|
Yes Nish, You are Correct. Actually there are many ways that we can implement it. I have given a very basic example. You given much better!
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
If everybody stored their datetime values properly as DateTime values and not as strings they would not get into this mess. Who is teaching all these awful habits?
|
|
|
|
|
Session["headline"] = dr["headline"];
Session["startdate"] = dr["startdate"];
Response.Redirect("newsedit.aspx");
next page
TextBox5.Text = Session["headline"].ToString();
String DateText = Session["startdate"].ToString();
String[] DatePart = DateText.Split('/');
string dd = DatePart[0].ToString();
string mm = DatePart[1].ToString();
string yy = DatePart[2].ToString();
DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
|
|
|
|
|
madhukk wrote: Session["headline"] = dr["headline"];
Session["startdate"] = dr["startdate"];
Response.Redirect("newsedit.aspx");
next page
TextBox5.Text = Session["headline"].ToString();
String DateText = Session["startdate"].ToString();
String[] DatePart = DateText.Split('/');
string dd = DatePart[0].ToString();
string mm = DatePart[1].ToString();
string yy = DatePart[2].ToString();
DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
What is ur question ?
madhukk wrote: DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
I guess this one.
What is the value of dd.ToString(); ? Does this exist on the dropdownlist? Hope now you understand what I want to mean
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
SELECT DAY(startDate) as day, MONTH(startDate) as month, YEAR(startDate) AS Year FROM YourTable
|
|
|
|
|
J4amieC wrote: SELECT DAY(startDate) as day, MONTH(startDate) as month, YEAR(startDate) AS Year FROM YourTable
No, no, no! That's MUCH too sensible ...
|
|
|
|
|
Hi,
I need to display the content in my site of a particular link using RSS.
Eg:
When a user click the link of a new which is displayed using RSS, i need to display the content also in my page, without going to another site or source site. For yahoo RSS we get all links, When we click a link it will redirect to yahoo site for the content.
How can i bring the content in to my site without going to yahoo? How it possible? Is it possible?
Thankyou
YPKI
|
|
|
|
|
I have already provided you the information in your last thread. For details you need to search google. If need to read all the content of RSS nothing else.
Please read this article,
An ASP.NET RSS Feed Reader[^]
Let me know if it clear to you !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I try this article.. but the content is opening in www.megatokyo.com site. My requriment is to display the particular content in my site itself.. is it possible?
|
|
|
|
|
Yes. make a HTTPRequest for that site. Read the HTTPResponse. Parse the text and display it in your page.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
can u please provide me an example
|
|
|
|
|
hi Abhijit ,
Can u provide me a example
|
|
|
|
|
Hi All,
i have question, in my project most of user control is Register in page as traditional manner. If i change to load the user control dynamically, Is any performance difference will be there.
My question is, i need to improve performance of page.If i load the user control dynamically.any improvement of Performance?
Please suggest Me.
Thanks In Advance..
JohnDas
|
|
|
|
|
Yes you can dynamically load User control for Peformance improvement. Even I will suggest you look into Partial Page Caching which will improve your site peroformance a lot.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
I have one server application and one client application. Server application directly connected to the database. Client application uses web service.
I am using Cache in my client application. I am using Web Service fetching Records from Server application Storing into the cache. With the help of that cache I am performing some updation on the fetched data and update the cache.(Not updating database).
Now if client application stop or end by any condition(Failure of power supply). If I restart the application i will get the again the same data as well as newly added data from server application.
Now I want save previously updated data as well as newly added data into cache.
From Where Should I get the previous data if the power failure happens?.
Is there any other solution for that.
Thanks,
sjs
|
|
|
|
|
If I understand you correctly, the cache is memory only on the client, so if it is powered down its gone. If it is a true client app (NOT a web page) you could write the cache out to disk each time it changed (probably only the changed bits) and reload it at start up.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|