我在转换timespan
时遇到困难,在sql server中,jamulai列数据类型为time
private void btntambah_Click(object sender, EventArgs e)
{
int kodejadwal = Int32.Parse(txtkode.Text);
string hari = txthari.Text;
TimeSpan jamulai = new TimeSpan (txtjam.Text);
string jamselesai = txtjam2.Text;
this.jadwalPraktekTableAdapter.Insert(hari, jamulai, jamselesai);
this.jadwalPraktekTableAdapter.Fill(healthy_CareDataSet.JadwalPraktek);
}
答案 0 :(得分:2)
要将时间跨度转换为字符串,您只需使用key outside find(): themes/seven/reset.css
key outside find(): themes/seven/style.css
key outside find(): sites/all/modules/ctools/css/ctools.css
key outside find(): modules/dblog/dblog.css
key outside find(): modules/overlay/overlay-child.css
key outside find(): sites/all/modules/panels/css/panels.css
key outside find(): modules/system/system.base.css
key outside find(): modules/system/system.admin.css
key outside find(): modules/system/system.menus.css
key outside find(): modules/system/system.messages.css
key outside find(): modules/system/system.theme.css
key outside find(): sites/all/modules/date/date_api/date.css
key outside find(): modules/field/theme/field.css
key outside find(): modules/node/node.css
key outside find(): modules/search/search.css
key outside find(): modules/user/user.css
key outside find(): sites/all/modules/views/css/views.css
executed
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
key inside find(): sites/all/modules/views/css/views.css
在您的情况下,您需要timespan.ToString()
要格式化时间跨度以适应MySQL的时间格式,您需要执行以下操作:
jamulai.ToString()
答案 1 :(得分:2)