0

第 1 步(工作)

//asp.net

public DataSet RepairList()
    {
        DataSet ds = new DataSet();
        try
        {
            openConnection();
            komut.CommandText = "RepairList";
            da.Fill(ds);
        }
        catch (Exception ex)
        {
            LogClass MyLog = new LogClass();
            MyLog.LogInsert("", "221", ex.ToString(), "0");
        }
        finally
        {
            closeConnection();
        }

        return ds;
    }

//sql

CREATE PROCEDURE [dbo].[RepairList]
AS
BEGIN
    SET NOCOUNT ON;
    Select Id, ProductId from Repairs Order By Id Desc
END

// result  
 1   3,
 2   4,
 4   9

第 2 步(不工作)我改变我的程序,它在 sql 中工作,但 asp.net 得到不同的结果

//asp.net

public DataSet RepairList()
    {
        DataSet ds = new DataSet();
        try
        {
            openConnection();
            komut.CommandText = "RepairList";
            da.Fill(ds);
        }
        catch (Exception ex)
        {
            LogClass MyLog = new LogClass();
            MyLog.LogInsert("", "221", ex.ToString(), "0");
        }
        finally
        {
            closeConnection();
        }

        return ds;
    }

//sql

ALTER PROCEDURE [dbo].[RepairList]
AS
BEGIN
    SET NOCOUNT ON;
    Select Id, ProductId, ImageUrl from Repairs Order By Id Desc
END

//sql result 

         1   3   asdf.jpg,
         2   4   df.jpg,
         4   9   sfkas.jpg


//asp.net result(wrong)  

         1   3,
         2   4,
         4   9

第 3 步(工作)我创建了相同的程序但名称不同(RepairList -> RepairsList)然后结果相同且正确

//asp.net

public DataSet RepairList()
    {
        DataSet ds = new DataSet();
        try
        {
            openConnection();
            komut.CommandText = "RepairsList";
            da.Fill(ds);
        }
        catch (Exception ex)
        {
            LogClass MyLog = new LogClass();
            MyLog.LogInsert("", "221", ex.ToString(), "0");
        }
        finally
        {
            closeConnection();
        }

        return ds;
    }


//sql


CREATE PROCEDURE [dbo].[RepairsList]
AS
BEGIN
    SET NOCOUNT ON;
    Select Id, ProductId, ImageUrl from Repairs Order By Id Desc
END
//sql result 
         1   3   asdf.jpg,
         2   4   df.jpg,
         4   9   sfkas.jpg

//asp.net result 
         1   3   asdf.jpg,
         2   4   df.jpg,
         4   9   sfkas.jpg

第2步我的问题是什么谢谢...

4

0 回答 0