自己搞吧 vb.net 语法 和c# 语法相差不大

解决方案 »

  1.   

    http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx
      

  2.   

    if Calendar1.SelectedDate.ToShortDateString = "0001-1-1" then
            remind_date = now.date
        end if 
    其他我都换好了,就这里会出错!
    帮忙换一下,我刚学不久做做参考嘛
      

  3.   

    回复楼上,这么写:
    if (Calendar1.SelectedDate.ToShortDateString == "0001-1-1")
    {
    remind_date = now.date;
    }==================================
    小小姑娘
    清早起床
    提着裤子上茅房
    茅房有人,不能再等
    只好拉在裤子上..................
    ==================================
      

  4.   

    这个now.date在C#中也不能使用!
    或者我不知道怎么用.
    取得当前时间的.用这个取不来
      

  5.   

    private void button1_Click(object sender, EventArgs e)
            {
                DateTime vDateTime = DateTime.Now;
                Text = vDateTime.ToString();
            }
      

  6.   

    c#里面是:
    DateTime.now()==================================
    小小姑娘
    清早起床
    提着裤子上茅房
    茅房有人,不能再等
    只好拉在裤子上..................
    ==================================
      

  7.   

    try..
    if (Calendar1.SelectedDate.ToShortDateString() == "0001-1-1")
    {
    remind_date = DateTime.Now.ToShortDateString();
    }
      

  8.   

    转化过后代码为:
    private void Page_Load(object sender, System.EventArgs e)
    {
     
    rqi.Text=System.DateTime.Now.ToString("yyyy-MM-dd");;
     BindData(); }

    #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void Selected_Click(object sender, System.EventArgs e)
    {
     rqi.Text = Calendar1.SelectedDate.ToShortDateString();
        BindData();
    } protected void BindData()
    {
     String remind_date;     remind_date = Calendar1.SelectedDate.ToShortDateString(); if (Calendar1.SelectedDate.ToShortDateString() == "0001-1-1")
    {
    remind_date = DateTime.Now.ToShortDateString();
    }
    SqlConnection myConnection=new SqlConnection("server=KC-AGANZI;uid=sa;pwd=123456;database=CCE;");
    SqlDataAdapter myCommand=new SqlDataAdapter("where addtime=#"&cdate(remind_date)&"# order by id desc",myConnection);
    DataSet ds=new DataSet();
    myCommand.Fill(ds,"KC_tixingshiwu");
           DataGrid1.DataSource=ds.Tables["KC_tixingshiwu"].DefaultView;
    DataGrid1.DataBind();
           myConnection.Close(); }
    这个cdate是什么意思?
      

  9.   

    cdate是VB的函数cdate(remind_date)=>DateTime.Parse(remind_date)
      

  10.   

    viena的建议我按照改了一下,出错
    SqlDataAdapter myCommand=new SqlDataAdapter("where addtime=#"&DateTime.Parse(remind_date)&"# order by id desc",myConnection);运算符“&”无法应用于“string”和“System.DateTime”类型的操作数!
    这样取得不行的!
    高手们,快点进来啊!
      

  11.   

    没注意看,其实转为DateTime是画蛇添足了
    直接连接字符串即可
    & cdate(remind_date) &
    改为
    + remind_date +另外你最前面不是Access,用OleDb的吗?
    怎么改SqlServer了?
    如果是SqlServer,#应换为'
      

  12.   

    & 是VB的字符串连接符,C#中用+
      

  13.   

    VB.NET的那代码是我同事写的.我不太熟悉!
    他用ACCESS做了这个功能,我用C#+SQL改掉.
    他比我强!