Dear all,
There are 5 columns with smalldatetime datatype and others columns too in my Table named tbltest. And I got the problem very interesting when I am inserting
DateTime.
The name of my column fields are
Dated, StartTime, EndTime, OnAirStartTime, OnAirEndTime.
And there is not any problem in my insert operation code:
db.Adapter("INSERT INTO tbltest (Dated,StartTime,EndTime,OnAirStartTime,OnAirEndTime,DurationStart,DurationOnAir,DeviceType,UnitName,VendorName,ActiveNetwork,SIM,ProfileUsed,Bitrate,ServerPort,CameraType,EventName,Division,Location,Stutus,Remarks,ReporterName,CameramanName,TechnicianName) VALUES ('" + Convert.ToDateTime(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Dated"].ToString()).ToString() + "',"
+ "'" + Convert.ToDateTime(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["StartTime"].ToString()).ToString() + "',"
+ "'" + Convert.ToDateTime(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["EndTime"].ToString()).ToString() + "',"
+ "'" + Convert.ToDateTime(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["OnAirStartTime"].ToString()).ToString() + "',"
+ "'" + Convert.ToDateTime(this.mysql.dataSet.Tables["liveoperation7"].Rows[i][5].ToString()).ToString() + "',"
+ "'" + Convert.ToInt32(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["DurationStart"].ToString()) + "',"
+ "'" + Convert.ToInt32(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["DurationOnAir"].ToString()) + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["DeviceType"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["UnitName"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["VendorName"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["ActiveNetwork"].ToString() + "',"
+ "'" + Convert.ToInt32(this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["SIM"].ToString()) + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["ProfileUsed"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Bitrate"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["ServerPort"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["CameraType"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["EventName"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Division"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Location"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Stutus"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["Remarks"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["ReporterName"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["CameramanName"].ToString() + "',"
+ "'" + this.mysql.dataSet.Tables["liveoperation7"].Rows[i]["TechnicianName"].ToString() + "')");
Passing 5 datetime values are:
Dated = 2016-10-05 00:00:00
StartTime = 2016-10-05 13:53:00
EndTime = 2016-10-05 13:55:00
OnAirStartTime = 2016-10-05 13:53:00
OnAirEndTime = 10/5/2016 13:54:30
>But, there is inserting in OnAirEndTime filed, the value of EndTime field.
Is there any problem the matching fields name ?
Or is there any limitation in MSSQL 2005 that there should not be more than 4 fields with
smalldatetime datatypes ?
What I have tried:
I have just change a OnAirEndTime datatype as varchar than its inserting exact value. But, why should I change datatype ?
Please help me to continuing smalldatatime as a datatype how much I need in a table.
Thank you.