如何知道String返回的内容 [英] How To know what String return
问题描述
让我们考虑我正在使用1个存储过程,如果记录保存则返回消息
然后
使用Grn No 1和Sr No 3成功记录保存
数字计算
,结果由asp.net页面获取
如果记录保存然后我想在消息框中显示
如果发生任何错误然后我想在标签中显示
所以我的是查询如何查找意味着我将保存结果字符串_result变量
所以我怎么知道Record Save或错误发生
do ii必须使用Linq或SubString以及如何?
Let''s Consider I am using 1 store procedure that return message if record save
then
Record Save Successfully with Grn No 1 and Sr No 3
numbers are calculated
and result is fetch by asp.net page
if record save then i want to show in message box
if any error occurs then then i want to show in Label
so my is query how to find means i am going to save result in String _result Variable
so how can i know that Record Save or error occurs
do ii have to use Linq or SubString and How??
推荐答案
您认为LINQ是什么?你是什么意思''substring''?您应该调用数据层,然后检查它返回的值,并编写代码以按预期呈现结果。我认为你正在抛出流行语,不知道它们的意思。
What do you think LINQ is ? What do you mean by ''substring'' ? You should call your data layer, and then check what values it returns, and write code to render the result as you expect. I think you''re throwing around buzzwords with no clue what they mean.
所以我的查询是如何找到意味着我将保存结果字符串_result变量
所以我怎么知道Record Save或错误发生
我必须使用Linq或SubString和How ??
当您调用存储过程来保存日期并且您的存储过程不包含任何错误处理技术时,您将收到必须在应用程序级别处理的错误。
和
让我们考虑一下我正在使用1商店程序,如果记录保存则返回消息
然后
使用Grn No 1和Sr No 3成功记录保存
在您的交易成功完成后从您的存储过程返回1,然后在您的应用程序中返回
"so my is query how to find means i am going to save result in String _result Variable
so how can i know that Record Save or error occurs
do ii have to use Linq or SubString and How??"
when you will call stored procedure to save date and your stored procedure does not contain any error handling technique, you will gotten error which you have to handled in application level.
and
"Let''s Consider I am using 1 store procedure that return message if record save
then
Record Save Successfully with Grn No 1 and Sr No 3
"
return 1 from your stored procedure when your transaction is completed successfully, then in your application
bool _result = Convert.ToBoolean(YourSqlCommand.ExecuteScalar());
之后,查看_result中是否有真值或错误
and after that, see if you have true value or false in _result
if(_result)
{
// data saved, so show message
HttpContext.Current.Response.Write("<script> alert('data saved'); </script>");
}
else
{
// data is not saved, show error or any proper message you want here
}
这篇关于如何知道String返回的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!