MysqlDateAdapter没有从mysql获取`Date` [英] MysqlDateAdapter not fetching `Date` from mysql

查看:80
本文介绍了MysqlDateAdapter没有从mysql获取`Date`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.....
我的查询未从Mysql Databse中获取Date列,并且未在gridview上显示"date列". Mysql命令是这样的:

Hi all.....
My query not fetching Date column from Mysql Databse.and not showing ''date column'' on gridview. Mysql command is like this:

select p.sno as RecieptNo,p.feesamount,p.totalpaid,p.dueamount,p.`paymentdate`,p.paymode,p.bank,p.checkno,p.status  from paymentdetails p,studentdetails s where p.sid=s.sid and s.class='" + DropDownList2.SelectedValue + "' and s.division='" + DropDownList3.SelectedValue + "' and s.rollno='" + DropDownList4.SelectedValue + "'  order by p.sno


谁能帮我.


Can any one please help me.
Thanks in advance.

推荐答案

首先:从字段名称列表中删除引号:将无济于事.

其次:检查您的paymentdetails表中是否有一个名为paymentdate的列,并且它是一个日期格式列.

第三:检查列中是否有数据.

如果以上所有操作均正常,我们需要在使用SELECT语句的地方查看代码片段.
我们还需要您得到的任何错误消息等.

我删除了引号,表中有列,并且是Date DataType,第三个是我有30多个列,但是我的代码不起作用:
Firstly: remove the quotation marks from the field names list: it won''t help.

Secondly: Check you have a column called paymentdate in your paymentdetails table, and that it is a date format column.

Thirdly: Check you have data in the column.

If all the above are OK, we need to see the code fragment where you use the SELECT statement.
We also need any error messages, etc., that you get.

"i removed quotation, had column in table and is a Date DataType third one is i had more than 30 columns but it won''t work my code is:
MySqlDataAdapter da = new MySqlDataAdapter("select p.sno as RecieptNo,p.feesamount,p.totalpaid,p.dueamount,p.paymentdate,p.paymode,p.bank,p.checkno,p.status  from paymentdetails p,studentdetails s where p.sid=s.sid and s.class=''" + DropDownList2.SelectedValue + "'' and s.division=''" + DropDownList3.SelectedValue + "'' and s.rollno=''" + DropDownList4.SelectedValue + "''  order by p.sno", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

其余所有列均进入gridview,但付款日期
显示输出时没有错误消息
谢谢"


奇怪的.尝试将select语句减少到最小:

remaining all columns coming into gridview except paymentdate
no error message while showing output
thank you"


Odd. Try cutting the select statement down to the minimum:

select p.sno, p.paymentdate from paymentdetails p

看发生了什么(这只是试图找出问题所在,而不是解决它-所以注释掉您现有的SELECT,您将再次需要它!)

如果可行,请尝试一次重新插入一些元素,直到出现错误.

如果我使用此查询(从paymentdetails p中选择p.sno,p.paymentdate),那么我只会收到不显示sno日期的列"

取出"p.sno":

and see what happens (this is just trying to work out where the problem is, not fix it yet - so comment out you existing SELECT, you will need it again!)

If this works, try re-inserting elements a few at a time until it goes wrong.

"if i use this query(select p.sno, p.paymentdate from paymentdetails p) then i get only sno date column not coming"

Take out "p.sno":

select paymentdate from paymentdetails

获取任何列?


我找到了解决方法先生....
特别感谢您的"OriginalGriff",您已经尝试了很多
解决方法是:
I found Solution sir....
special thanks to you ''OriginalGriff'', you are tried a lot
Solution is :
<Columns>
     <asp:BoundField HeaderText="RecieptNo" DataField="sno" />
    <asp:BoundField HeaderText="Amount" DataField="feesamount"  />
   <asp:BoundField HeaderText="Paid" DataField="totalpaid" />
   <asp:BoundField HeaderText="Due Amount" DataField="dueamount"  />
  <asp:BoundField HeaderText="Date(M/D/YY)" DataField="paymentdate" />
    <asp:BoundField HeaderText="PaymentMode" DataField="paymode" />
    <asp:BoundField HeaderText="Bank" DataField="bank" />
    <asp:BoundField HeaderText="CheckNo" DataField="checkno"/>
   <asp:BoundField HeaderText="Status" DataField="status" />
</Columns>


这样我也可以获取日期列.


in this way i am getting date column also.


这篇关于MysqlDateAdapter没有从mysql获取`Date`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆