非常郁闷 命名设置了 时间格式 “yy-mm-dd” 但是插入数据库 还是 这样 06  3 2008 12:0  而且每条 后面都有 12:0  不知道是什么原因 时间控件是 Calendar 

解决方案 »

  1.   

    你數據庫的區域
    的時間格式本來就那樣吧。。
    數據庫是用了DataTime 来存的吗?
      

  2.   


      是的 用datatime 友问题?
      

  3.   

    这样的话 你直接对表做手工的加数据 它还是显示那乱其八糟的格式要么改区域别要么就在查询出来的时候 Format一下 在显示
      

  4.   

       SqlDateTime 溢出。 无语
      

  5.   

    可能是数据库默认语言的问题,可以使用 select @@language 查看,在select的时候用convert(datetime,字段,120)转换一下。
      

  6.   

      select @@language  用这个命令 试了下 显示简体中文  什么意思哦?
      

  7.   


      像 VS 这种自带的 Calendar  控件 时间要怎么处理比较好 怎么判断它小于的 system.DataTime.now 我是把选择的时间放到一个 textbox 文本框 但是这样无法比较哦 
      
          望高手帮忙
      

  8.   

     string time = Calendar1.SelectedDate.ToString("yyyy - MM - dd");
            TextBox2.Text = time;
                    try
                    {                    if (myFile.PostedFile != null)
                        {                        if (myFile.PostedFile.FileName != "")
                            {
                                //定义一些变量   
                                string nam = myFile.PostedFile.FileName;//获取上传文件的完整名称
                                string ImgName = nam.Substring(nam.LastIndexOf(@"\") + 1);
                                string ImgExtend = nam.Substring(nam.LastIndexOf(".") + 1);//获取上传图片的格式
                                //int i = nam.LastIndexOf(@"\");
                                //string newnm = nam.Substring(i + 1);
                                if (!(ImgExtend == "bmp" || ImgExtend == "jpg" || ImgExtend == "gif"))
                                {                                Label10.Visible = true;
                                    Label10.Text = "上传图片的格式不正确!";
                                    Button1.Text = "保存失败";                            }
                                else
                                {
                                    //Response.Write("//1.jpg".TrimStart('/'));
                                    //Response.Write(Server.MapPath("upload"));//可以用这个来跟踪下
                                    string uploadname = Server.MapPath("~/upload/");//获取服务器上指定虚拟路径相对路径的文件夹
                                    //改变下面的“c:\\"到你想要保存的地址。   
                                    //myFile.PostedFile.SaveAs(@"C:\Documents and Settings\Administrator\桌面\完整的Test\asp.net\AWC1\upload\" + ImgName);
                                    myFile.PostedFile.SaveAs(uploadname + ImgName);                                ////取得上传文件的各种属性。   
                                    //fielname = myFile.PostedFile.FileName;
                                    //fielname = ( "<IMG src='" + newnm  + "'/>");
                                    fielname = ImgName;
                                    //fenc.Text=myFile.PostedFile.ContentType   ;   
                                    //fsize.Text=myFile.PostedFile.ContentLength.ToString();  
                                    SqlParameter[] coll = new SqlParameter[9];//实例化 coll 来调用存储过程,根据参数的个数【】里面就写多少
                                    coll[8] = new SqlParameter("@productid", SqlDbType.Int, 4);
                                    coll[8].Value = Int32.Parse(dod.AutoNum("select product_ID from t_Product", "t_Product", "product_ID", "0"));//product_ID 字段自增长                                coll[0] = new SqlParameter("@Name ", SqlDbType.VarChar, 50);
                                    coll[0].Value = txtproductname.Text;                                coll[1] = new SqlParameter("@type ", SqlDbType.VarChar, 50);
                                    coll[1].Value = protype.SelectedValue;
                                    coll[2] = new SqlParameter("@date ", SqlDbType.DateTime);
                    这个就是时间 :   coll[2].Value = TextBox2.Text;
                                    coll[3] = new SqlParameter("@uprice ", SqlDbType.Char, 18);
                                    coll[3].Value = txtproductuprice.Text;
                                    coll[4] = new SqlParameter("@price", SqlDbType.Char, 18);
                                    coll[4].Value = txtproductprice.Text;
                                    coll[5] = new SqlParameter("@page", SqlDbType.VarChar, 50);
                                    //coll[5].Value = this.myFile.PostedFile.FileName;
                                    coll[5].Value = fielname;
                                    coll[6] = new SqlParameter("@beizhu ", SqlDbType.VarChar, 50);
                                    coll[6].Value = this.TextBox1.Text;
                                    coll[7] = new SqlParameter("@Status ", SqlDbType.Int, 4);
                                    coll[7].Value = 0;
                                    Dbconn.ExecutePorcedure("p_Ins_Product", coll);
                                    Label10.Visible = true;                                Label10.Text = "上传图片成功";
                                    Button1.Text = "保存成功";
                                }                        }
                            else
                            {
                                Label10.Visible = true;
                                Label10.Text = "您未上传图片";
                                Button1.Text = "保存失败";
                            }                    }
                    }
                    catch (Exception error)
                    {
                        Label10.Visible = true;
                        Label10.Text = "上传失败失败!原因为:" + error.ToString();
                        Button1.Text = "保存失败";
                    }            }
         
          
      

  9.   

      这个插入时间没问题 等我更新或者修改的时候 sqlDataTime 就溢出了  我数据的的时间字段类型是 datatime 类型