在条件下使用数据时,数据未插入数据库中 [英] Data is not inserting in database when using it in condition

查看:96
本文介绍了在条件下使用数据时,数据未插入数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果条件在DataReader中变为假,我会尝试插入项目.条件运行良好,但数据未插入数据库中.这是下面的代码:请建议我为什么不插入

I try to insert the items if the condition become false with the DataReader. The condition runs fine but data is not inserted in database . Here is my code below: Please suggest me why its not inserting

推荐答案

您没有在足够足够的信息附近提供任何信息:
1)我们不知道TextUtilities.ToSql的实际作用.
2)我们不知道GetDataReader的作用-尽管我们可以猜测,但了解细节可能很重要.
3)我们不知道InsertTable的作用-我们可以再次猜测,但这不是诊断性的.

在pReader的定义上设置一个断点,然后单步执行.
您需要知道代码遵循的路径,以及为什么不遵循您期望的路径.

顺便说一句:
We can''t really tell from that what the problem is; you haven''t provided anywhere near enough information:
1) We don''t know what TextUtilities.ToSql actually does.
2) We don''t know what GetDataReader does - though we can guess, it may be important to know the details.
3) We don''t know what InsertTable does - again we can guess, but that isn''t diagnostic.

Put a breakpoint on the definition of pReader, and single step through.
You need to know what path the code is following,and why, if it isn''t following the one you expect.

BTW:
if (pReader.HasRows)
{


}
else

{
   ...

这是做事的非常丑陋的方式.试试:

That is a very ugly way to do things. Try:

if (!pReader.HasRows)
{
   ...


我们只是在.cs文件中添加了该实用程序的引用.所以告诉我如何调试它"

在这种情况下,请提供更多详细信息,例如实用程序的详细信息"

您应该尝试的一些事情

1.如果可以获取DLL的PDB文件,则仍然可以附加调试器.
2.如果该工具基于.NET构建,则可以使用任何重构工具从DLL生成其源代码
"We just add the reference of that utility in our .cs file . So tell me how to debug it"

In that case please provide some more details like ''details of utility program''

a few thing you shall try

1.If you can get the PDB file of your DLL, you can still attach your debugger.
2.if the tool is build on .NET, you can use any refactor tool to get generate its source code from DLL


这篇关于在条件下使用数据时,数据未插入数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆