Quantcast
Channel: DataSource Controls - SqlDataSource, ObjectDataSource, etc.
Viewing all articles
Browse latest Browse all 956

How to check if data is in the database

$
0
0

Hello all,

I have a problem to find a method to check whether the data is available in the table. I have a button called 'dashboard'. i would like to make something like thing

    Protected Sub button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim id = Session("UsrId").ToString
if "id equal to a data inside table buyerdata column buyer_username" then
Response.Redirect("~/buyer_dashboard.aspx")
else
response.redirect("~/agent_dashboard.aspx)
    End Sub

im already have sqldatasource inside the .aspx

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:epropertyConnectionString1 %>" SelectCommand="SELECT [buyer_username] FROM [buyerdata] WHERE ([buyer_username] = @buyer_username)" onselected="SqlDataSource1_Selected"><SelectParameters><asp:Parameter DefaultValue="" Name="buyer_username" Type="String" /></SelectParameters></asp:SqlDataSource>

I am still do not know how to do the : if "id equal to a data inside table buyerdata column buyer_username" then ......

thanks in advance


Viewing all articles
Browse latest Browse all 956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>