我正在使用C#和SQL Server 2008制作管理程序.我希望一次使用血型,区和俱乐部名称来搜索记录.这就是问题所在:
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Table2
WHERE @Blood_Group =" + tsblood.Text + "AND @District =" + tsdist.Text +
"AND Club_Name =" + tscname.Text, Mycon1);
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我什么是正确的语法?Tnx提前.:)
当我向多个客户端发送短信时,它会给出错误操作超时和错误在HttpWebResponse上
我试过myReq.Timeout = 50000; myReq.ReadWriteTimeout = 50000;
但在第150行给出相同的错误错误
Line 148: myReq.Timeout = 50000;
Line 149: myReq.ReadWriteTimeout = 50000;
Line 150: HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
Line 151: System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
Line 152: string responseString = respStreamReader.ReadToEnd();
我试图使用MSDN上描述的方法在本地计算机上显示已安装的打印机列表...
using System.Drawing;
using System.Drawing.Printing;
namespace SandBox
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
{
Console.WriteLine(PrinterSettings.InstalledPrinters[i]);
}
Console.ReadLine();
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题出在Using声明中,'Printing'命名空间无法解析.我还缺少一个额外的参考吗?
更新:我已添加对System.Drawing&的引用,System.Printing但这不能解决问题.
首先请说明一下,是的,这里有大量"与分辨率无关的C#WPF布局"相关问题.我的问题与此没有直接关系,我已经阅读了大部分内容,并阅读了几个教程.
目标:
由于我是WPF的新手,我的目标是有一个明确的方法来设计一个独立的屏幕分辨率的复杂,逼真的GUI,并在用户调整窗口大小时适当缩放.
混乱的原因:
我对许多教程和stackoverflow帖子建议的大量选项感到困惑,使用Viewbox,流动布局,相对布局,使用不同类型的容器,以及WPF应该是设计独立于分辨率的事实.
题:
我没有任何打算开始辩论的意图,我知道不是为了这个.我只是想知道我计划用来设计我的真实GUI的这个程序是否正确.
1>在Illustrator中设计一个样机(或直接在Blend中设计,我不知道应该使用哪个)
2>使用(不知道哪个)布局设计1024 x 768分辨率时,通过WPF中的拖放设计复制它
3>当我的用户启动我的应用程序时,获取屏幕大小并通过做一些数学来调整每个控件的大小(Yukh!这真的是我必须这样做吗?WPF的独立性是什么意思,那不是真的拖累和滴设计是吗?)
我的大多数应用程序都是数据库驱动的数据输入和操作表单 我使用的是业内常见的正确策略,还是我错过了什么?
非常感谢

我尝试了这段代码,但根本没有为上述场景工作
private void key_up(object sender,EventArgs e)
{
if (dataGridView1.CurrentRow == null) return;
if (dataGridView1.CurrentRow.Index - 1 >= 0)
{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index - 1].Cells[0];
dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Selected = true;
}
}
Run Code Online (Sandbox Code Playgroud) 我尝试编译使用 node.js 中的 http_parser 的简单 c/c++ 应用程序,我也使用 libuv ,并且基本上尝试在 Windows 中编译此示例。使用 Visual Studio 2008
但我收到此编译错误:
>d:\dev\cpp\servers\libuv\libuv_http_server\http_parser.h(35) : error C2371: 'int8_t' : redefinition; different basic types
1> d:\dev\cpp\servers\libuv\libuv-master\libuv-master\include\uv-private\stdint-msvc2008.h(82) : see declaration of 'int8_t'
Run Code Online (Sandbox Code Playgroud)
http_parser.h 文件中的代码如下所示:
#include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
#include <BaseTsd.h>
#include <stddef.h>
//#undef __int8
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t; …Run Code Online (Sandbox Code Playgroud) 我有这个double价值:
var value = 52.30298270000003
Run Code Online (Sandbox Code Playgroud)
当我把它转换成它时string,它失去了它的精度:
var str = string.Format("{0} some text...", value);
Console.WriteLine(str); // output: 52.3029827
Run Code Online (Sandbox Code Playgroud)
我的值的精度数double可能会在运行时更改.如何强制该string.Format方法使用所有精度?
我创建了一个具有倒数计时器的Windows 8应用程序.我有计时器的代码,它工作正常,但不是从120秒倒计时,我希望它显示为2:00分钟,从那里倒计时.但因为我使用计时器,我不知道如何使用日期/时间属性(如果我甚至可以这样做).请帮我解决这个问题.
这是我的计时器代码:
DispatcherTimer timer;
private int counter = 120;
public ArcadeMode()
{
InitializeComponent();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += timer_Tick;
timer.Start();
}
async void timer_Tick(object sender, object e)
{
await Time.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, () => { Time.Text = counter.ToString(); });
counter--;
}
Run Code Online (Sandbox Code Playgroud) 我喜欢在using语句中包含我的数据访问,以使自己对垃圾收集感觉良好.我正在运行Visual Studio 2013 Preview并以.NET 4.5为目标.我有一个叫做WordsController的ApiController:
public class WordsController : ApiController
{
// GET api/<controller>
public IEnumerable<Keyword> Get()
{
using (TestDataContext dc = new TestDataContext())
{
return dc.Keywords;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到一个错误,告诉我在访问数据之前已经处理了datacontext.
将代码更改为此工作原理:
public class WordsController : ApiController
{
// GET api/<controller>
public IEnumerable<Keyword> Get()
{
TestDataContext dc = new TestDataContext();
return dc.Keywords;
}
}
Run Code Online (Sandbox Code Playgroud)
为什么不在usingDataContext 时才能工作?
c# ×9
.net ×2
asp.net-mvc ×1
double ×1
sql-server ×1
time ×1
timer ×1
visual-c++ ×1
winforms ×1
wpf ×1