| |

VerySource

 Forgot password?
 Register
Search
View: 703|Reply: 5

Problem with modification

[Copy link]

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-31 21:20:01
| Show all posts |Read mode
After modifying a date type data, an error is displayed: Int32 to DateTime conversion is invalid
Reply

Use magic Report

0

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-12 13:45:01
| Show all posts
Please paste the relevant code
Reply

Use magic Report

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-3-15 14:45:02
| Show all posts
int ID = Convert.ToInt32 (this.dList.DataKeys [e.Item.ItemIndex] .ToString ()); // take the current corresponding ID number
int House = Convert.ToInt32 (((TextBox) e.Item.FindControl ("txtHouse")). Text.ToString ());
string SerialNumber = ((TextBox) e.Item.FindControl ("txtSerialNumber")). Text.ToString ();
string Name = ((TextBox) e.Item.FindControl ("txtName")). Text.ToString ();
string Phone = ((TextBox) e.Item.FindControl ("txtPhone")). Text.ToString ();
string Email = ((TextBox) e.Item.FindControl ("txtEmail")). Text.ToString ();
string CheckInDate = Convert.ToDateTime (((TextBox) e.Item.FindControl ("CheckInDate")). Text.ToString ()). ToString ();
string CheckOutDate = Convert.ToDateTime (((TextBox) e.Item.FindControl ("CheckOutDate")). Text.ToString ()). ToString ();
int Confirm = Convert.ToInt32 (((DropDownList) e.Item.FindControl ("ddlConfirm")). SelectedValue.ToString ());
string Remark = ((TextBox) e.Item.FindControl ("txtRemark")). Text.ToString ();
string Datetime = Convert.ToDateTime (((TextBox) e.Item.FindControl ("txtDatetime")). Text.ToString ()). ToString ();
Schedule updateOne = new Schedule ();
updateOne.Update (ID, House, SerialNumber, Name, Phone, Email, CheckInDate, CheckOutDate, Confirm, Remark, Datetime);
this.dList.EditItemIndex = -1;
this.mfbind ();
}
Reply

Use magic Report

0

Threads

31

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-3-17 20:45:01
| Show all posts
Just monitor the variables. How can I see this runtime error?
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-18 14:00:01
| Show all posts
This situation also appeared when I first started learning, you look at the format of the date in the database, if 2016-12-22
Format, you just have to convert it.
Reply

Use magic Report

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-3-19 10:00:01
| Show all posts
How to convert, specifically
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list