小编Ish*_*han的帖子

SQL查询错误 - "列不能为空"

我有一个SQL查询:

String S = Editor1.Content.ToString(); 
     Response.Write(S);    
    string sql = "insert into testcase.ishan(nmae,orders) VALUES ('9',@S)"; 
   OdbcCommand cmd = new OdbcCommand(sql, myConn); 
            cmd.Parameters.AddWithValue("@S", S);  
            cmd.ExecuteNonQuery(); 
Run Code Online (Sandbox Code Playgroud)

错误:System'Data.Odbc.OdbcConnection.HandleError中的列'orders'不能为null

c# mysql sql asp.net

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

继续执行Exception

下面是我想要执行的脚本.这里的问题是一旦发生异常就会停止执行,我continue在catch块中使用但是没有用.即使在发生异常后它如何循环,我如何使它工作foreach.

我也使用了while($true)循环但是进入了无限循环.怎么去呢?

$ErrorActionPreference = "Stop";
try 
{
# Loop through each of the users in the site
foreach($user in $users)
{
    # Create an array that will be used to split the user name from the domain/membership provider
    $a=@()


    $displayname = $user.DisplayName
    $userlogin = $user.UserLogin


    # Separate the user name from the domain/membership provider
    if($userlogin.Contains('\'))
    {
        $a = $userlogin.split("\")
        $username = $a[1]
    }
    elseif($userlogin.Contains(':'))
    {
        $a = $userlogin.split(":")
        $username = $a[1]
    }

    # Create …
Run Code Online (Sandbox Code Playgroud)

error-handling powershell continue

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

在材料 ui 中使用自定义输入自动完成不起作用

我可以通过从列表中选择值来使用自动完成功能。现在我想在选择中添加一个新值。我尝试了多种选择,包括onChange但无法实施。

在此输入图像描述

如果用户输入内容并在文本框外部单击,则它应该将自由文本转换为标签。此外,允许用户继续从预定义列表/自由文本添加更多标签。

我正在尝试这里的选项,但没有运气。这是否可能,或者我是否需要寻找其他选择?

autocomplete reactjs material-ui react-component

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

在c#中使用select count(*)

    String dd_webCofig = ConfigurationManager.ConnectionStrings["server132"].ConnectionString;
    SqlConnection ddlistconn = new SqlConnection(dd_webCofig);
    ddlistconn.Open();

    string ddlist = "select count(*) from jud_order where complex_name=@a and case_no=@b and sign=@c and jud_order_date=@d and user_code=@e";
    SqlCommand ddlistCmd = new SqlCommand(ddlist, ddlistconn);
    ddlistCmd.Parameters.AddWithValue("a", "a");
    ddlistCmd.Parameters.AddWithValue("b", "a");
    ddlistCmd.Parameters.AddWithValue("c", "a");
    ddlistCmd.Parameters.AddWithValue("d", "a");
    ddlistCmd.Parameters.AddWithValue("e", "a");

    SqlDataReader myReader = ddlistCmd.ExecuteReader();
Run Code Online (Sandbox Code Playgroud)

我有上面的查询返回行数,现在我的问题是如何读取查询的输出?我想要的是

 if(count=0)
{ 
   //Do
} 
else if(counnt >0)
{
    //Do something else
}
Run Code Online (Sandbox Code Playgroud)

c# sql asp.net

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

输入字符串格式不正确时出错

单击按钮时出现以下错误 输入字符串的格式不正确,

点击按钮我调用以下方法:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.IO;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
/// <summary>
/// Summary description for pdfgeneration
/// </summary>
public class pdfgeneration
{
    public pdfgeneration()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public void pdfgenerator(String name1, AjaxControlToolkit.HTMLEditor.Editor Editor1)
    {

        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ContentType = "application/pdf";
        // Create PDF document
        Document pdfDocument = new Document(PageSize.A4, 70, 55, 40, 25);

        PdfWriter wri = PdfWriter.GetInstance(pdfDocument, new FileStream("e://" +name1 + ".pdf", FileMode.Create)); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net itextsharp

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

在ASP.net c#web应用程序中显示警告框

我想在用户点击按钮时显示警告消息.

Signed点击此按钮我有一个按钮" "我想显示一条警告信息" Are you sure you want to continue?"和此警告信息框中的两个按钮" Yes"和" No".

点击"是"按钮,我想要update function执行一次,点击" No"只有警报应该关闭,当前页面没有变化.

请有人能指导我如何继续这个吗?

c# asp.net alert

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

如何从vb.net中的日期时间中提取日期部分

我有一个SQL查询,它提取数据类型的字段smalldatetime.我使用datareader读取此字段,将其转换为字符串并将其存储在字符串变量中.

我得到的字符串为1/1/2012 12:00:00 AM,这里我只想使用此字符串的日期部分而且我与时间无关.

如何从字符串中仅剪切日期并获得输出为1/1/2012

vb.net asp.net datetime date

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

如何从网络摄像头捕获视频(在java中)?

我想在java中开发一个应用程序,用于从网络摄像头捕获视频并将其存储到特定位置.任何人都可以向我提供工作代码吗?

网络摄像头的哪种类型(usb,ip等..)是开发应用程序的最佳选择.

请帮我.如何进行?

java webcam video-capture

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

正则表达式接受从0到100的所有小数

我想修改我现有的正则表达式,它接受从0到99.99的小数

\d{0,2}(\.\d{1,2})?$ 
Run Code Online (Sandbox Code Playgroud)

我希望这是接受

100
100.0
100.00
Run Code Online (Sandbox Code Playgroud)

并且不应该接受

100.1
100.02
101
Run Code Online (Sandbox Code Playgroud)

谁能帮我修改上面的RE

regex

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

使用javascript在asp.net中设置图像控件的图像URL

我有一个Image,FileUpload和一个Button控件.我想从FileUpload控件获取的本地路径将图像保存到服务器.我在C#的Button Click上实现了这个功能.

现在我想设置Image控件的图像URL OnClientClick实现服务器端代码的相同按钮.

根据FileUpload控件中选择的文件,图像URL将每次推迟.任何人都可以帮助我理解如何使用javascript来设置基于文件上传控件中选择的thre文件的图像URL?

javascript image imageurl

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