小编Mah*_*ami的帖子

在SQL Server游标中获取多个值

我有一个游标,其中包含我想要一次处理的行中的几列.我注意到我看到的关于如何使用游标的大多数示例都显示它们将光标中的特定列一次分配给一个标量值,然后移动到下一行,

例如

OPEN db_cursor  
FETCH NEXT FROM db_cursor INTO @name  

WHILE @@FETCH_STATUS = 0  
BEGIN  
       --Do Stuff with @name scalar value, then get next row from cursor

       FETCH NEXT FROM db_cursor INTO @name  
END
Run Code Online (Sandbox Code Playgroud)

我想知道的是,是否可以执行以下操作:

    OPEN db_cursor  
    FETCH NEXT FROM db_cursor; 

    WHILE @@FETCH_STATUS = 0  
    BEGIN  
           SET @myName = db_cursor.name;
           SET @myAge = db_cursor.age;
           SET @myFavoriteColor = db_cursor.favoriteColor;
           --Do stuff with scalar values

           FETCH NEXT FROM db_cursor; 
    END
Run Code Online (Sandbox Code Playgroud)

总是感谢帮助.

sql t-sql sql-server cursor

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

千位分隔符,用于formatString中的整数

我想在文本块中显示数字,在xaml中有千位分隔符,但没有浮点数.我该怎么做.我尝试了以下代码:

StringFormat={}{0:N}
Run Code Online (Sandbox Code Playgroud)

它显示浮点.

StringFormat={}{0:000'.'000}}
Run Code Online (Sandbox Code Playgroud)

它显示1234像001,234它怎么能这样做?

c# wpf

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

使用实体框架时,System.Threading.TimerCallback仅触发一次

我正在开发一个简单的应用程序,该应用程序每60秒检查一次数据库。我曾经System.Threading.TimerCallback这样做,但是,当我运行该应用程序时,它只会滴答一次。

这是代码:

private void Form1_Load(object sender, EventArgs e)
    {
        // Create the delegate for the Timer type. 
        System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(d);

        // Establish timer settings. 
        System.Threading.Timer t = new System.Threading.Timer(
          timeCB,     // The TimerCallback delegate object. 
          null,       // Any info to pass into the called method (null for no info). 
          0,          // Amount of time to wait before starting (in milliseconds). 
          1000);      // Interval of time between calls (in milliseconds). 
    }

    void m(object o)
    {
        System.Media.SystemSounds.Hand.Play();
        SReminderEntities …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework timer winforms

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

标签 统计

c# ×2

cursor ×1

entity-framework ×1

sql ×1

sql-server ×1

t-sql ×1

timer ×1

winforms ×1

wpf ×1