1、在数据库中为datetime类型的,比如start_date字段为2006-01-02 00:00:00.000,但是导出为.xml格式后变为
<start_date>2006-01-02T00:00:00+08:00</start_date> 了,我现在要把.xml再导入到数据库就导不进了,该怎样再转换成时间类型啊?2、private void button5_Click(object sender, EventArgs e)
{
if (ds1.Tables.Count > 0)
{
try
{
SqlConnection con1 = new SqlConnection(con);
con1.Open();
SqlCommand cmd;
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
switch (comboBox2.SelectedIndex)
{
case 0:
instr = "insert into goods(code_g,code_g01,name_g) values('" + ds1.Tables[0].Rows[i]["code_g"] + "','" + ds1.Tables[0].Rows[i]["code_g01"] + "','" + ds1.Tables[0].Rows[i]["name_g"] + "')";
break;
…………
}我现在要把数据插入到goods前,要把这个表的所有触发器先关闭掉,待数据全部插入后再打开触发器,该把alter table goods disable trigger all写在哪啊?我刚才把它写在instr中的话,每插入一条数据,就要关闭和打开触发器,效率非常慢!!我希望把全部数据插入到表后再打开触发器,该怎样写?
<start_date>2006-01-02T00:00:00+08:00</start_date> 了,我现在要把.xml再导入到数据库就导不进了,该怎样再转换成时间类型啊?2、private void button5_Click(object sender, EventArgs e)
{
if (ds1.Tables.Count > 0)
{
try
{
SqlConnection con1 = new SqlConnection(con);
con1.Open();
SqlCommand cmd;
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
switch (comboBox2.SelectedIndex)
{
case 0:
instr = "insert into goods(code_g,code_g01,name_g) values('" + ds1.Tables[0].Rows[i]["code_g"] + "','" + ds1.Tables[0].Rows[i]["code_g01"] + "','" + ds1.Tables[0].Rows[i]["name_g"] + "')";
break;
…………
}我现在要把数据插入到goods前,要把这个表的所有触发器先关闭掉,待数据全部插入后再打开触发器,该把alter table goods disable trigger all写在哪啊?我刚才把它写在instr中的话,每插入一条数据,就要关闭和打开触发器,效率非常慢!!我希望把全部数据插入到表后再打开触发器,该怎样写?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货