在vb.net中找不到记录时如何显示错误消息 [英] How to display error message when record not found in vb.net

查看:103
本文介绍了在vb.net中找不到记录时如何显示错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了将二进制数据转换为pdf的代码,目的是在sql中没有可用日期时显示错误消息,否则pdf文件应该有人可以帮助我怎么做.

I created code for converting binary data to pdf my aim is to show error message when date is not avalable in sql otherwise it should pdf file can anyone help me how to do.

推荐答案

您可能想尝试一下

Dim csname1 As String = "PopupScript"
Dim csname2 As String = "ButtonClickScript"
Dim cstype As Type = Me.GetType()

Dim cs As ClientScriptManager = Page.ClientScript

If (Not cs.IsStartupScriptRegistered(cstype, csname1)) Then

  Dim cstext1 As String = "alert('Record not found');"
  cs.RegisterStartupScript(cstype, csname1, cstext1, True)

End If

您还可以使用此处给出的方法 http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/executing-javascript-code-from-server

You can also use the approach given here http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/executing-javascript-code-from-server

如您所见,它将加载脚本,您既可以加载该脚本,也可以创建一个函数,然后像telerik中的VB示例那样调用它,或者混合两种方法来适合您.

As you can see it will load the script, you either can load that script or can create a function and call it like VB example in telerik or Mix both approaches to suit you.

这篇关于在vb.net中找不到记录时如何显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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