Web Forms :: If Date Is Not Inserted It Shows 1900-01-01 In Database?
May 7, 2015
i am using date field in sql table , and in webforms , i am using a textbox relating to calendar extender toolkit , now if i won't select anydate from calendar , on debugging it shows "" but in database it shows 1900-01-01 . what's this going on ? i have also written on button click event :
protected void SubmitProject_OnServerClick(object sender, EventArgs e) {
if (StartDate.Text == "" || StartDate.Text == string.Empty) {
rec.Proj_StartDate = DBNull.Value.ToString();
} else {
rec.Proj_StartDate=Request.Form[StartDate.UniqueID];
}
}
also i id like this too :
protected void SubmitProject_OnServerClick(object sender, EventArgs e) {
if (StartDate.Text == "" || StartDate.Text == string.Empty) {
rec.Proj_StartDate = string.Empty;
} else {
rec.Proj_StartDate=Request.Form[StartDate.UniqueID];
}
}
but nothing happened , it still shows 1900-01-01 in database.
View 1 Replies
Similar Messages:
Jan 28, 2011
Using c# and SQL.
Populating a gridview and want to check whether the Taskdate which is in column 5 in the gridview contains "1/1/1900". If contains I need to make it blank. I use template fields.
Here is the code I used. But it does not work.
[code]....
View 4 Replies
Dec 17, 2010
I had created Data Entry webform. Data is stored in Database. I have created 'Date' coloumn in database table with data type datetime. I want to isnert todays date automatically when data is inserted through form in DataBase.My current query to store data in database is:
public bool MyData(string COL1,string COL2,string COL3,string COL4,string COL5)
{
string SQL = "insert into TABLE values('" + COL1+ "','" + COL2+ "','" + COL3 + "','" + COL4 + "','" + COL5 + "')";
}
View 10 Replies
Feb 15, 2011
I was adding ContentPlaceHolder by dragging it from the Toolbox to a master page. Depending on the spot where it is inserted, the mark up generated is different:
[Code]....
Is the control name ContentPlaceHolder or contentplaceholder?
When I drag ContentPlaceHolder2 to the bottom of the page, after </html>, it stays unchanged for a while. Then when I formatted it (Ctrl-K, Ctrl-H), the control became contentplaceholder!!
View 2 Replies
Feb 2, 2010
I am getting a DataTable from query against AS400 database. The field that clearly contains birth dates is interpreted as decimal. I am having trouble even converting it to string.
View 1 Replies
Aug 22, 2010
In my mysql I have an autoincrement id , whenever I add a new row into database I need to store this id in other table, so how to get this autoincrement Id back?
View 4 Replies
Apr 19, 2010
My prob is that when data inserted in database after that without any button click the new record show in popup box ?
View 10 Replies
Jul 4, 2010
how to hyperlink the database table (which shows in gird view in next page)
View 4 Replies
Dec 23, 2015
I have table in database that one column is Expire date that save date like below
2015-11-23
Now I want compare it whit today date like below:
if (_dr["ExpireDate"]<DateTime.Now) {
}
But it makes error can you tell me true code for it?
View 1 Replies
Apr 12, 2010
here is my code:
My sql query is returning 2 rows by my repeater is only displaying 1.
[Code]....
View 3 Replies
Sep 20, 2010
I have to create a text box where if user will enter something it should show the values from database like google shows.e.g If i press a it should display a if i have entered AJ it should show all the list which start from AJ.Same like google.
View 10 Replies
Oct 13, 2010
When i insert empty datepicker value, database is inserting this value '1/1/1900 12:00:00
How can i stop that and insert null values to empty date pickers
i have done like this, but it didnt work
[code]....
View 2 Replies
Mar 8, 2011
I am want to get data which is inserted or updated today only...and i should be able to copy that data to excel or any other format.
View 2 Replies
Jun 11, 2012
I am trying to insert a record into a MySQL Table. I thought that the Insert methods returned the number of records that were successfully inserted. But that is not what I found. My code:
Code:
dim n as integer
n = taProject.InsertProject(pname, descr, idManager, startdate, tenddate, client, disable)
I get n = 0 even though the record is installed. How can I determine if the insert was successful or not?
View 1 Replies
Nov 30, 2010
I wonder how to validate if a inserted item in a Combobox exists in a database during postback? If the item.text exists, a errormessage should notify the user that the item already exists in the database. If the item does not exists in the database a inserting should be done.
Should i use the customvalidator and create a servervalidationfunction that searches my databasetable for the item name?
Should i validate inside one of the two ComboBox control events, ItemInserting and ItemInserted?
After validating the existence i would like to validate if the inserting to the database was successfull.
View 1 Replies
Jul 3, 2010
I have this image upload code...that works....but I need a code to get the Id of the image that i just uploaded..
Protected Sub ImageButton_AddImage_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton_AddImage.Click
Dim IntLength As Integer
Dim ArrContent As Byte()
[Code]....
View 1 Replies
Mar 15, 2011
I want to know how to display a blank value when the data value is '01/01/1900 12:00:00 AM' on a gridview. I went through the details of '01/01/1900' in sql and the gridview display But couldn't find any combination of this type.
View 2 Replies
Apr 15, 2010
supose i have one table nd there are many records in table .this table access by many usewhen any user inserted record in database then show message in popup boxnd this message show in all users
View 4 Replies
Feb 9, 2010
I'm trying make FormView insert a new row into a database table via a stored procedure.My code runs without error but nothing appears in the database table.
View 14 Replies
Jul 16, 2012
I bind dropdownlist in my page
protected void Page_Load(object sender, EventArgs e) {
BindDropDownList(DDL1, "city1", "name", "ID");
DDL1.Items.Insert(0, new ListItem("select city", "0"));
}
And SP
LTER procedure [dbo].[city1]
as
begin
select id,Name
from city
end
And design code
<asp:DropDownList ID="DDL2" runat="server" CssClass="daddsd">
</asp:DropDownList>
And here is imagebutton code that when click on it update data into table
protected void ImageButton_Click1(object sender, ImageClickEventArgs e) {
string data = Server.UrlDecode(Request.QueryString["BehCode2"]);
SqlCommand _cmd = new SqlCommand("insertinfo", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
[Code] ....
Here when i click on button it insert all data into table but it didn't insert my selected item from dropdownlist it insert select city that i define in page_load
DDL1.Items.Insert(0, new ListItem("select city", "0"));
And when i delete this code from page load it insert in table first row of my table it didn't insert my selected item from dropdown list.
View 1 Replies
Jan 15, 2010
I have data entry form like...There are some empty rows and some of them have values. User can Update existing values and can also fill value in empty rows.I need to map these values in my DB table and some of them will be inserted as new rows into the database and existing record will be updated.I need your suggestions, How can I accomplish this scenario with best approach.
View 2 Replies
May 5, 2014
how to display msg ni label after data entered in databas in asp.net with c#
View 1 Replies
Apr 29, 2010
I have some issues about retrieveing and storing date information to my database (ms sql server 2005).My data column is a DateTime, and i have set my web.config globalization culture is set to "en-gb"
When i retrieve date from the datebase it appears as dd/MM/yy, that's fine. But i cannot insert a new date as same format?! It will only accept MM/dd/yy or yy/mm/dd.Right now i'm using this code to correct the error:
[Code]....
Is it possible to change the date format on the database or something, so i dont need to use this code?
View 11 Replies
Aug 6, 2010
I have a tectbox "Date" in the report parameter page in asp.net
Now, the default value of that date should come from the query:"SELECT TOP1 DATE FROM AUSFLEET_USER.SYS_STOCKTAKE"
WHERE STOCKTAKE_STATUS='POSTED' "
my SQL connection string is aadbaf (lets say)
View 4 Replies
Sep 29, 2010
I have a table in orcale database where I am inserting records. I am able to insert a record in a table but it is not being saved permenantly.When inserting there is no error. what could be causing this?
View 4 Replies