English 中文(简体)
数据库链接和查询的自动核对[封闭]
原标题:Automated checking of database connection and query in same database [closed]
  • 时间:2011-06-03 12:06:59
  •  标签:
  • c#
  • sql

I am trying to figure out code working for an auto testing as follows: (in C# code, SQL database used)

  1. Check whether database (having credentials) is working fine or down?
  2. If working, run a select query in it & check for succesful execution.
  3. In any case of failure for above 2 points, automatically send an email to somemone.

请帮助我。 我认为,这将是各位专家的ake。

感谢

最佳回答

可以通过简单总结数据库在某些错误处理中的要求来实现这些不同步骤。 总体结构类似:

try
{
  // Perform your SELECT statement
}
catch (SqlException e)
{
  // Log the error, send an email, etc.
}

至于这些评论的范围,我猜想的是,这要到你确定。 选任考试委员会可通过一个办公室,LINQ2SQL, ADO。 NET等。 但是,错误的伐木通常会是你的记录错误,发送电子邮件通常会寄送电子邮件(在服务电话背后全心全意地提取,而不是在<条码>>上对你的员工和管理当局协调署服务器进行人工打击)。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签