小编Nej*_*the的帖子

DevExpress将GridView导出到Excel

我真的需要这方面的帮助..我在互联网上找不到任何例子我使用DevExpress GridView我需要将它发送到excel并且我遇到问题循环到每个单元格和列,因为DevExpress包含不同的方法然后的DataGridView

那是我想写的代码..我真的感谢你的帮助

    public class Form1 : System.Windows.Forms.Form
    {
    Microsoft.Office.Interop.Excel.ApplicationClass ExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();

    string FirstName = "First Name";
    string FatherName = "Father Name";
    string LastName = "Last Name";
    }
    public Form1()
    {
        ExcelApp.Application.Workbooks.Add(Type.Missing);
        ExcelApp.Columns.ColumnWidth = 20;
        //
        // Required for Windows Form Designer support
        //
        InitializeComponent();

        //
        // TODO: Add any constructor code after InitializeComponent call
        //
    }
    private void simpleButton1_Click(object sender, System.EventArgs e)
    {
        try
        {
            OleDbConnection con = new OleDbConnection();
            con.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\\Users\\pc\\Documents\\Emp.xlsx;Extended Properties=\"Excel 12.0;HDR=Yes\"";

            con.Open(); …
Run Code Online (Sandbox Code Playgroud)

c# excel devexpress

9
推荐指数
1
解决办法
5万
查看次数

抑制列并删除水晶报告中的空白区域

我正在使用Microsoft Visual Studio 2003.

我正在寻找一种方法来抑制列是否为空,并替换其他列留下的空白.

我到处搜索,但找不到2003版本的兼容方式.

存在一种简单的方法吗?我感谢任何帮助.

c# crystal-reports winforms

5
推荐指数
1
解决办法
1万
查看次数

Cursorfetch:INTO 列表中声明的变量数量必须与所选列的数量匹配

declare @id int
declare @empid int
set @id = 0
declare @schedindate datetime
declare @ss nvarchar(100)
declare @indice nvarchar(2)
declare @FromDate datetime
declare @ToDate datetime
declare @TimeInR datetime
declare @TimeOutR datetime
set @FromDate = '2009-01-14'
set @ToDate = '2010-01-30'

Declare cc cursor for select distinct empid from ta_timecard where schedindate between @FromDate and @ToDate
open cc
fetch next from cc into @empid
while (@@fetch_status = 0)
begin
    set @id = @id + 1
    insert into ta_MonthlyAttendance (ID, EmpID) values (@id, …
Run Code Online (Sandbox Code Playgroud)

sql sql-server sql-server-2000 cursor sql-update

4
推荐指数
1
解决办法
2万
查看次数

在TextBox中添加数字

我有这个代码,它只有在所有textBox包含值时才有效..但如果文本框为空,我会收到错误..

Int32 Total = Int32.Parse((txtChild1.Text))
            + Int32.Parse(txtChild2.Text)
            + Int32.Parse(txtChild3.Text)
            + Int32.Parse(txtWife1.Text)
            + Int32.Parse(txtWife2.Text)
            + Int32.Parse(txtWife3.Text);
Run Code Online (Sandbox Code Playgroud)

我知道它必须是像IsNull这样的函数,但对于整数值.有谁知道它是什么?

c# null textbox function

3
推荐指数
1
解决办法
337
查看次数

将新列添加到GridView DevExpress

我正在从Excel导入工作表.我需要在网格的末尾添加一个新单元格,其中包含有关空单元格的消息,我将它们保存在名为msg的数组中;

    private void simpleButton1_Click(object sender, System.EventArgs e)
    {
        try
        {
            OleDbConnection con = new OleDbConnection();
            con.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\\Users\\pc\\Documents\\Emp.xlsx;Extended Properties=\"Excel 12.0;HDR=Yes\"";

            con.Open();
            DataTable dtSchema;
            dtSchema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
            OleDbCommand Command = new OleDbCommand ("select * FROM [" + dtSchema.Rows[0]["TABLE_NAME"].ToString() + "]", con);
            OleDbDataAdapter da = new OleDbDataAdapter(Command);
            DataSet ds = new DataSet ();
            da.Fill(ds);
            dataGrid1.DataSource = ds.Tables[0];
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }   

        string[] msg = new string[50];
        for (int i = …
Run Code Online (Sandbox Code Playgroud)

c# excel devexpress winforms

3
推荐指数
1
解决办法
2万
查看次数

为每条记录选择多条记录

我正在编写一个sql语句,其中用户应输入'From Date'和'To Date'(少于31天)对于每个日期我需要从与员工相关的表中选择字段

我需要一个简单方法的逻辑..应该在一段时间内?

我通过此查询获得了日期列表:

DECLARE @date TABLE(d DATETIME)

DECLARE @d DATETIME
SET @d = '20090101'

WHILE @d <= '20090102' BEGIN

    INSERT INTO @date VALUES (@d)
    SET @d = @d + 1

END

SELECT d AS DateCol,  dbo.ta_DayOfWeek(d) AS Day,
DATENAME(weekday, DATEADD(day,0,d)) AS DayName FROM @date
Run Code Online (Sandbox Code Playgroud)

这些是我需要用于每个记录的一些字段:

SELECT  ta_timecard.EmpID ,
        emp.name ,
        emp.code ,
        ta_timecard.schedindate--,
FROM ta_timecard
INNER JOIN emp ON ta_timecard.empid = emp.id
WHERE ta_timecard.schedindate BETWEEN @FromDate AND @ToDate
GROUP BY ta_timecard.EmpID ,
        emp.name ,
        emp.code ,
        ta_timecard.schedindate
Run Code Online (Sandbox Code Playgroud)

提前致谢.

在此输入图像描述

sql t-sql sql-server

3
推荐指数
1
解决办法
106
查看次数