无效的列名称“帐户”

时间:2019-10-08 14:23:35

标签: java sql sql-server java-8 netbeans-8

我的代码执行得很好,但是在我的java输出上执行之后,它显示为列名帐户无效的错误。

这是我的查询字符串,

{
  String sql = 
  "SELECT [account]" +"[date] 
   FROM [reports].[dbo].[acc] 
   WHERE [account='"+str+"'";
}

例外:

Exceptioncom.microsoft.sqlserver.jdbc.SQLServerException: The column name account is not valid

1 个答案:

答案 0 :(得分:0)

尝试一下:

$args = array(
    'numberposts'   => -1, // -1 is for all
    'post_type'     => 'location', // or 'post', 'page'
    'orderby'       => 'date', // or 'date', 'rand'
    'order'         => 'ASC', // or 'DESC'

    // http://codex.wordpress.org/Template_Tags/get_posts#Usage
);

$posts = get_posts($args);
foreach ($posts as $post) {
    $result = get_post_meta($post->ID);
    $post->postMeta = $result;
}