C# 客户端Windows窗体应用程序出错,仅在我的计算机上正确执行

C# 客户端Windows窗体应用程序出错,仅在我的计算机上正确执行,c#,sql,winforms,visual-studio-2010,connection-string,C#,Sql,Winforms,Visual Studio 2010,Connection String,我有一个带有SQL compact数据库的windows窗体应用程序。它在许多windows PC上运行。客户端PC使用德语。它总是为SQL连接函数(如添加、删除等)返回错误 语言差异可能是原因吗 其他信息 我检查了所有这些都是由于日期的差异,因为我的日期是2011年1月11日,当时是2011年11月11日,也是时间格式,并修复了 然而另一个错误现在,我不明白为什么在我的电脑,我创建安装程序,然后安装它,我不面对这个错误 The error was in german so i

我有一个带有SQL compact数据库的windows窗体应用程序。它在许多windows PC上运行。客户端PC使用德语。它总是为SQL连接函数(如添加、删除等)返回错误

语言差异可能是原因吗

其他信息

我检查了所有这些都是由于日期的差异,因为我的日期是2011年1月11日,当时是2011年11月11日,也是时间格式,并修复了

然而另一个错误现在,我不明白为什么在我的电脑,我创建安装程序,然后安装它,我不面对这个错误

        The error was in german so i translated it and pasting below:



information on invoking just-in debugging
instead of this dialog box you will find at the end of this release.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an object instance.
   at HotelReservationSystem.MyAppartments.DrawPricePeriods (Graphics g) in D: \ ERDDESKTOPPAPP \ New 834th
   (Object sender, PaintEventArgs e) at HotelReservationSystem.MyAppartments.panelAppartments_Paint in D: \ ERDDESKTOPPAPP \ New 332nd
   at System.Windows.Forms.Control.PaintWithErrorHandling (PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint (Message & m)
   at System.Windows.Forms.Control.WndProc (Message & m)
   (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.NativeWindow.Callback


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300).
    CodeBase: file: / / / C: / Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll.
----------------------------------------
hotel reservation system
    Assembly Version: 1.0.0.0.
    Win32 Version: 1.0.0.0.
    CodeBase: file: / / / C: / Program% 20file% 20 (x86) / Microsoft / hotel setup / bin / Release / HotelReservationSystem.exe.
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.235 built by: RTMGDR.
    codebase:
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 built by: RTMRel.
    codebase:
----------------------------------------
System
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.236 built by: RTMGDR.
    CodeBase: file: / / / C: / Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll.
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 built by: RTMRel.
    codebase:
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300).
    codebase:
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.233 built by: RTMGDR.
    codebase:
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.233 built by: RTMGDR.
    codebase:
----------------------------------------
System.Windows.Forms.resources
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 built by: RTMRel.
    codebase:
----------------------------------------
System.Data.DataSetExtensions
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 built by: RTMRel.
    codebase:
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 built by: RTMRel.
    codebase:
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100).
    codebase:
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100).
    codebase:
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100).
    codebase:
----------------------------------------
mscorlib.resources
    Assembly Version: 4.0.0.0.
    Win32 Version: 4.0.30319.235 (RTMGDR.030319-2300).
    codebase:
----------------------------------------

************** JIT Debugging **************
To the JIT debugging (Just-In-Time) to activate, must be in the
Configuration file of the application or computer
(Machine.config) jitDebugging the value in the system.windows.forms section are determined.
The application must be compiled with debugging enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</ Configuration>

When JIT debugging is enabled, any unhandled
Exceptions to the JIT debugger sent on the
Computer is registered and handled by this dialog box.
               ERROR LINES END HERE , THE CODE REFERRING TO ABOVE...Funstions
错误是德语的,所以我将其翻译并粘贴到下面:
有关仅在调试中调用的信息
您将在本版本末尾找到此对话框,而不是此对话框。
**************例外文本**************
System.NullReferenceException:对象引用未设置为对象实例。
在HotelReservationSystem.MyAppartments.DrawPricePeriods(图g)中的D:\erdDeskTopApp\New 834
(对象发送者,PaintEventArgs e)位于HotelReservationSystem.MyAppartments.panelAppartments_的D:\erdDeskTopApp\New 332nd中
在System.Windows.Forms.Control.PaintEventArgs处理(PaintEventArgs e,Int16层)
位于System.Windows.Forms.Control.WmPaint(消息和m)
在System.Windows.Forms.Control.WndProc上(消息&m)
(IntPtr hWnd、Int32 msg、IntPtr wparam、IntPtr lparam)位于System.Windows.Forms.NativeWindow.Callback
**************加载的程序集**************
mscorlib
程序集版本:4.0.0.0。
Win32版本:4.0.30319.239(RTMGDR.030319-2300)。
代码库:文件:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll。
----------------------------------------
酒店预订系统
程序集版本:1.0.0.0。
Win32版本:1.0.0.0。
代码库:文件:///C:/Program%20文件%20(x86)/Microsoft/hotel setup/bin/Release/HotelReservationSystem.exe。
----------------------------------------
System.Windows.Forms
程序集版本:4.0.0.0。
Win32版本:4.0.30319.235生成者:RTMGDR。
代码库:
----------------------------------------
系统图
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1生成者:RTMRel。
代码库:
----------------------------------------
系统
程序集版本:4.0.0.0。
Win32版本:4.0.30319.236生成者:RTMGDR。
代码库:文件:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0_b77a5c561934e089/System.dll。
----------------------------------------
可达性
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1生成者:RTMRel。
代码库:
----------------------------------------
系统数据
程序集版本:4.0.0.0。
Win32版本:4.0.30319.237(RTMGDR.030319-2300)。
代码库:
----------------------------------------
系统核心
程序集版本:4.0.0.0。
Win32版本:4.0.30319.233生成者:RTMGDR。
代码库:
----------------------------------------
命名空间
程序集版本:4.0.0.0。
Win32版本:4.0.30319.233生成者:RTMGDR。
代码库:
----------------------------------------
System.Windows.Forms.resources
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1生成者:RTMRel。
代码库:
----------------------------------------
System.Data.DataSetExtensions
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1生成者:RTMRel。
代码库:
----------------------------------------
数字系统
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1生成者:RTMRel。
代码库:
----------------------------------------
系统配置
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1(RTMRel.030319-0100)。
代码库:
----------------------------------------
系统.交易
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1(RTMRel.030319-0100)。
代码库:
----------------------------------------
系统企业服务
程序集版本:4.0.0.0。
Win32版本:4.0.30319.1(RTMRel.030319-0100)。
代码库:
----------------------------------------
mscorlib.resources
程序集版本:4.0.0.0。
Win32版本:4.0.30319.235(RTMGDR.030319-2300)。
代码库:
----------------------------------------
**************JIT调试**************
要激活JIT调试(及时),必须在
应用程序或计算机的配置文件
(Machine.config)确定system.windows.forms节中的值。
必须在启用调试的情况下编译应用程序。
例如:
启用JIT调试时,任何未处理的
在上发送的JIT调试器的异常
此对话框已注册并处理计算机。
错误行到此结束,代码引用了上述功能
第834行是空行。。。。。。。 私有无效期(图g) { 画笔=画笔.CadetBlue; pen.Color=Color.White; RoundRect.DrawRoundRect(g,pen,2,50796,((numpartments+1)*60)+200+(10*(numpartments-1)),30); RoundRect.FillRoundRect(g,画笔,2,50796,((numpartments+1)*60)+200+(10*(numpartments-1)),30)

RoundRect.DrawRoundRect(g,pen,2,507962000,30);
RoundRect.FillRoundRect(g,画笔,2,50796200,30);
sf.Alignment=StringAlignment.Center;
刷子=刷子。白色;
矩形rect=新矩形(2,50796,30);
Font f=新字体(fontFamily,12);
开关(语言)
{
案例1:
g、 抽绳(“请在黄色字段中输入您的价格周期!在白色字段中输入您的价格!”,f,画笔,(矩形f)rect,sf);
打破
案例2:
g、 抽绳(“请将白色的头发插在手心里!”,f,画笔,(直板)
        RoundRect.DrawRoundRect(g, pen, 2, 50, 796, 200, 30);
        RoundRect.FillRoundRect(g, brush, 2, 50, 796, 200, 30);

        sf.Alignment = StringAlignment.Center;
        brush = Brushes.White;
        Rectangle rect = new Rectangle(2, 50, 796, 30);
        Font f = new Font(fontFamily, 12);
        switch (language)
        {
            case 1:
                g.DrawString("Please enter in the yellow fields you price periods! And white fields your prices!", f, brush, (RectangleF)rect, sf);
                break;
            case 2:
                g.DrawString("Por favor inserte en las casillas blancas sus temporadas!", f, brush, (RectangleF)rect, sf);
                break;
            case 3:
                g.DrawString("Molimo unesite u žutim prozorima periode cijene! I u bijelim vaše cijene", f, brush, (RectangleF)rect, sf);
                break;
        }
        rect = new Rectangle(2, 70, 796, 30);
        switch (language)
        {
            case 1:
                g.DrawString("Please enter first your day (field TT) and then month (field MM)", f, brush, (RectangleF)rect, sf);
                break;
            case 2:
                g.DrawString("Por favor primero insierta el día (casilla TT) después el mes (casilla MM)", f, brush, (RectangleF)rect, sf);
                break;
            case 3:
                g.DrawString("Molimo prvo unesite datum dana (prozor DD) i onda mijesec (prozor MM)", f, brush, (RectangleF)rect, sf);
                break;
        }
        sf.Alignment = StringAlignment.Near;
        rect = new Rectangle(255, 50, 796, 30);
        brush = Brushes.Yellow;
        if(language == 1)
        {
            g.DrawString("yellow", f, brush, (RectangleF)rect, sf);
        }

        int w = 140, h = 40, x = 20, y = 150, xinc = 0, yinc = 40;

        string[] periods = new string[5];
        switch (language)
        {
            case 1:
                periods = new string[5] { "First Price Period", "Second Price Period", "Third Price Period", "Fourth Price Period", "Fifth Price Period" };
                break;
            case 2:
                periods = new string[5] { "Temporada 1", "Temporada 2", "Temporada 3", "Temporada 4", "Temporada 5" };
                break;
            case 3:
                periods = new string[5] { "Perioda 1", "Perioda 2", "Perioda 3", "Perioda 4", "Perioda 5" };
                break;
        }

        Point p;
        int count = 0;
        switch (numPricePeriods)
        {
            case 1:
                {
                    x = 796 / 2 - 70;
                    p = new Point(x, y);
                    brush = Brushes.White;
                    g.DrawString(periods[0], f, brush, (PointF)p, sf);
                    brush = Brushes.Yellow;
                    RoundRect.DrawRoundRect(g, pen, x, y + 30, w - 10, h + 10, 10);
                    RoundRect.FillRoundRect(g, brush, x, y + 30, w - 10, h + 10, 10);
                    arrtbxPPDuration[0].Location = new Point(x + 5, y + 45);
                    arrtbxPPDuration[0].ForeColor = Color.Gray;
                    arrtbxPPDuration[0].Text = "TT/MM to TT/MM";
                    arrtbxPPDuration[0].Show();

                    yinc = 150;
                    for (int j = 0; j < numAppartments; j++)
                    {
                        RoundRect.DrawRoundRect(g, pen, x, y + yinc, w - 10, 60, 10);
                        brush = Brushes.LightGray;
                        RoundRect.FillRoundRect(g, brush, x, y + yinc, w - 10, 60, 10);
                        arrtbxPricePeriods[count].Location = new Point(x + 5, y + yinc + 15);
                        arrtbxPricePeriods[count].Show();
                        count++;
                        yinc += 70;
                    }
                }
                break;
            case 2:
                {
                    x = (796 / 3);
                    for (int i = 0; i < numPricePeriods; i++)
                    {
                        p = new Point(x - 70, y);
                        brush = Brushes.White;
                        g.DrawString(periods[i], f, brush, (PointF)p, sf);
                        brush = Brushes.Yellow;
                        RoundRect.DrawRoundRect(g, pen, x - 70, y + 30, w - 10, h + 10, 10);
                        RoundRect.FillRoundRect(g, brush, x - 70, y + 30, w - 10, h + 10, 10);


                        //THIS IS THE 834th LINE


                        arrtbxPPDuration[i].Location = new Point(x - 65, y + 45);
                        arrtbxPPDuration[i].ForeColor = Color.Gray;
                        arrtbxPPDuration[i].Text = "TT/MM to TT/MM";
                        arrtbxPPDuration[i].Show();
                        x += (796 / 3);
                    }


                    yinc = 150;
                    for (int i = 0; i < numAppartments; i++)
                    {
                        x = (796 / 3);
                        for (int j = 0; j < numPricePeriods; j++)
                        {
                            RoundRect.DrawRoundRect(g, pen, x - 70, y + yinc, w - 10, 60, 10);
                            brush = Brushes.LightGray;
                            RoundRect.FillRoundRect(g, brush, x - 70, y + yinc, w - 10, 60, 10);
                            arrtbxPricePeriods[count].Location = new Point(x - 65, y + yinc + 15);
                            arrtbxPricePeriods[count].Show();
                            count++;
                            x += (796 / 3);
                        }
                        yinc += 70;
                    }
                }
                break;
            case 3:
                {
                    x = (796 / 4);
                    for (int i = 0; i < numPricePeriods; i++)
                    {
                        p = new Point(x - 70, y);
                        brush = Brushes.White;
                        g.DrawString(periods[i], f, brush, (PointF)p, sf);

                        brush = Brushes.Yellow;
                        RoundRect.DrawRoundRect(g, pen, x - 70, y + 30, w - 10, h + 10, 10);
                        RoundRect.FillRoundRect(g, brush, x - 70, y + 30, w - 10, h + 10, 10);
                        arrtbxPPDuration[i].Location = new Point(x - 65, y + 45);
                        arrtbxPPDuration[i].ForeColor = Color.Gray;
                        arrtbxPPDuration[i].Text = "TT/MM to TT/MM";
                        arrtbxPPDuration[i].Show();
                        x += (796 / 4);
                    }

                    yinc = 150;
                    for (int i = 0; i < numAppartments; i++)
                    {
                        x = (796 / 4);
                        for (int j = 0; j < numPricePeriods; j++)
                        {
                            RoundRect.DrawRoundRect(g, pen, x - 70, y + yinc, w - 10, 60, 10);
                            brush = Brushes.LightGray;
                            RoundRect.FillRoundRect(g, brush, x - 70, y + yinc, w - 10, 60, 10);
                            arrtbxPricePeriods[count].Location = new Point(x - 65, y + yinc + 15);
                            arrtbxPricePeriods[count].Show();
                            count++;
                            x += (796 / 4);
                        }
                        yinc += 70;
                    }
                }
                break;
            case 4:
                {
                    x = (796 / 5);
                    for (int i = 0; i < numPricePeriods; i++)
                    {
                        p = new Point(x - 70, y);
                        brush = Brushes.White;
                        g.DrawString(periods[i], f, brush, (PointF)p, sf);

                        brush = Brushes.Yellow;
                        RoundRect.DrawRoundRect(g, pen, x - 70, y + 30, w - 10, h + 10, 10);
                        RoundRect.FillRoundRect(g, brush, x - 70, y + 30, w - 10, h + 10, 10);
                        arrtbxPPDuration[i].Location = new Point(x - 65, y + 45);
                        arrtbxPPDuration[i].ForeColor = Color.Gray;
                        arrtbxPPDuration[i].Text = "TT/MM to TT/MM";
                        arrtbxPPDuration[i].Show();
                        x += (796 / 5);
                    }
                    yinc = 150;
                    for (int i = 0; i < numAppartments; i++)
                    {
                        x = (796 / 5);
                        for (int j = 0; j < numPricePeriods; j++)
                        {
                            RoundRect.DrawRoundRect(g, pen, x - 70, y + yinc, w - 10, 60, 10);
                            brush = Brushes.LightGray;
                            RoundRect.FillRoundRect(g, brush, x - 70, y + yinc, w - 10, 60, 10);
                            arrtbxPricePeriods[count].Location = new Point(x - 65, y + yinc + 15);
                            arrtbxPricePeriods[count].Show();
                            count++;
                            x += (796 / 5);
                        }
                        yinc += 70;
                    }
                }
                break;
            case 5:
                {
                    x = (796 / 6);
                    int diff = 110;
                    for (int i = 0; i < numPricePeriods; i++)
                    {
                        p = new Point(x - diff, y);
                        brush = Brushes.White;
                        g.DrawString(periods[i], f, brush, (PointF)p, sf);

                        brush = Brushes.Yellow;
                        RoundRect.DrawRoundRect(g, pen, x - diff, y + 30, w - 10, h + 10, 10);
                        RoundRect.FillRoundRect(g, brush, x - diff, y + 30, w - 10, h + 10, 10);
                        arrtbxPPDuration[i].Location = new Point(x - diff + 5, y + 45);
                        arrtbxPPDuration[i].ForeColor = Color.Gray;
                        arrtbxPPDuration[i].Text = "TT/MM to TT/MM";
                        arrtbxPPDuration[i].Show();
                        x += (796 / 6);
                    }

                    yinc = 150;
                    for (int i = 0; i < numAppartments; i++)
                    {
                        x = (796 / 6);
                        for (int j = 0; j < numPricePeriods; j++)
                        {
                            RoundRect.DrawRoundRect(g, pen, x - diff, y + yinc, w - 10, 60, 10);
                            brush = Brushes.LightGray;
                            RoundRect.FillRoundRect(g, brush, x - diff, y + yinc, w - 10, 60, 10);
                            arrtbxPricePeriods[count].Location = new Point(x - diff + 5, y + yinc + 15);
                            arrtbxPricePeriods[count].Show();
                            count++;
                            x += (796 / 6);
                            diff -= 20;
                        }
                        yinc += 70;
                    }
                }
                break;
        }

    }

                        yinc = 150;
                        for (int i = 0; i < numAppartments; i++)
                        {
                            x = (796 / 6);
                            for (int j = 0; j < numPricePeriods; j++)
                            {
                                RoundRect.DrawRoundRect(g, pen, x - diff, y + yinc, w - 10, 60, 10);
                                brush = Brushes.LightGray;
                                RoundRect.FillRoundRect(g, brush, x - diff, y + yinc, w - 10, 60, 10);
                                arrtbxPricePeriods[count].Location = new Point(x - diff + 5, y + yinc + 15);
                                arrtbxPricePeriods[count].Show();
                                count++;
                                x += (796 / 6);
                                diff -= 20;
                            }
                            yinc += 70;
                        }
                    }
                    break;
            }

        }