日期:2014-05-20  浏览次数:20907 次

出现一下错误:“DGGL.SQL.strSQL”是“字段”,但此处被当做“方法”来使用 请各位大虾帮忙解决下。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace DGGL
{
  public partial class chakandaigoubiao : Form
  {
  string connectString;
  DataTable dt;
  SqlParameter[] paras = new SqlParameter[4];
  int pageCount, pageSize, pageIndex, recordCount;
  bool error;

  public chakandaigoubiao()
  {
  InitializeComponent();
  }

  private void button3_Click(object sender, EventArgs e)
  {
  this.Close();
  }

  private void chakandaigoubiao_Load(object sender, EventArgs e)
  {
  pageSize = 50;
  pageIndex = 0;
  [color=#FF0000] connectString = SQL.strSQL(); //错误发生点。[/color]

  if (!backgroundWorker1.IsBusy)
  backgroundWorker1.RunWorkerAsync();
  }

  private void button4_Click(object sender, EventArgs e)
  {

  if (pageIndex == 0)
  return;

  pageIndex = 0;

  if (!backgroundWorker1.IsBusy)
  backgroundWorker1.RunWorkerAsync();
  }

  private void button5_Click(object sender, EventArgs e)
  {
  if (pageIndex < 1)
  return;

  pageIndex--;
  if (!backgroundWorker1.IsBusy)
  backgroundWorker1.RunWorkerAsync();
  }

  private void getPage(int pIndex)
  {
  dt = new DataTable();
  using (SqlConnection con = new SqlConnection(connectString))
  {
  SqlCommand sc = new SqlCommand();
  sc.Connection = con;
  sc.CommandType = CommandType.StoredProcedure;
  sc.CommandText = "Pages";

  paras[0] = new SqlParameter("@PageIndex", SqlDbType.Int);
  paras[0].Value = pIndex;
  paras[1] = new SqlParameter("@PageSize", SqlDbType.Int);
  paras[1].Value = pageSize;
  paras[2] = new SqlParameter("@RecordCount", SqlDbType.Int);
  paras[2].Direction = ParameterDirection.Output;
  paras[3] = new SqlParameter("@PageCount", SqlDbType.Int);
  paras[3].Direction = ParameterDirection.Output;

  for (int i = 0; i < paras.Length; i++)
  sc.Parameters.Add(paras[i]);

  SqlDataAdapter da = new SqlDataAdapter(sc);
  da.Fill(dt);
  }
  }

  private void button6_Click(object sender, EventArgs e)
  {
  if (pageIndex == pageCount - 1)
  return;

  pageIndex++;

  if (!backgroundWorker1.IsBusy)
  backgroundWorker1.RunWorkerAsync();
  }

  private void button7_Click(object sender, EventArgs e)
  {
  if (pageIndex == pageCount - 1)
  return;

  pageIndex = pageCount - 1;