如果搜索没有匹配的单词

如果搜索没有匹配的单词

本文介绍了如果搜索没有匹配的单词,如何显示消息框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我创建了一个搜索,我希望有一条弹出消息,如果用户搜索单词不存在,则会告诉用户没有找到记录。继承我的搜索代码。 btw伙计这是asp vb



我尝试过:



Dim searchword As String

searchword =select * from tblstudinfo where(studentid like'%+ searchtxt.Text.ToString())

SqlDataSource1.SelectCommand = searchword

Hello guys i created an search and i want to have an popup message that will tell the user like "no records found" if the user search word doesn't exist record. heres my code for searching. btw guys this is asp vb

What I have tried:

Dim searchword As String
searchword = "select * from tblstudinfo where (studentid like '%" + searchtxt.Text.ToString() )"
SqlDataSource1.SelectCommand = searchword

推荐答案

Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)

  If e.AffectedRows = 0 Then

     Response.Write("<script language=""javascript""> alert('No match records.');</script>")

  End If

End Sub



最后但并非最不重要的,你应该学习 []由于 []


这篇关于如果搜索没有匹配的单词,如何显示消息框。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 11:29