Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   get a msg that "ID ALREADY EXIST" (http://www.go4expert.com/forums/msg-id-exist-t25053/)

ranchani 23Feb2011 23:58

get a msg that "ID ALREADY EXIST"
 
i am a beginner, i don't how to give command

how to display a msgbox that " ID already exist " for a given textbox

should i use getfocus if so how????? or is there another way???????/

ranchani 24Feb2011 00:02

Re: get a msg that "ID ALREADY EXIST"
 
[quote=ranchani;79805]i am a beginner, i don't how to give command

how to display a msgbox that " ID already exist " for a given textbox

should i use getfocus if so how????? or is there another way???????

in vb

lionaneesh 24Feb2011 11:22

Re: get a msg that "ID ALREADY EXIST"
 
1. Please try and edit your previous post rather than...Just posting a new one..
2. use the quote tags properly..
3. Please clear you question...You want a alert box or a simple error text...

ranchani 24Feb2011 20:04

Re: get a msg that "ID ALREADY EXIST"
 
Quote:

Originally Posted by lionaneesh (Post 79827)
1. Please try and edit your previous post rather than...Just posting a new one..
2. use the quote tags properly..
3. Please clear you question...You want a alert box or a simple error text...

anything is fine as long as it works

lionaneesh 24Feb2011 20:56

Re: get a msg that "ID ALREADY EXIST"
 
Quote:

Originally Posted by ranchani (Post 79896)
anything is fine as long as it works

In VB because i can make it in javascript if you are OK with it!!

ranchani 25Feb2011 20:38

Re: get a msg that "ID ALREADY EXIST"
 
no i want only in vb

shyam_oec 26Feb2011 17:48

Re: get a msg that "ID ALREADY EXIST"
 
Quote:

Originally Posted by ranchani (Post 79973)
no i want only in vb

Hi,
You can use MsgBox function,have you tried that ?

ranchani 26Feb2011 21:14

Re: get a msg that "ID ALREADY EXIST"
 
yeah but i not sure where to give the statement and i hav tried everything

shyam_oec 26Feb2011 21:43

Re: get a msg that "ID ALREADY EXIST"
 
Quote:

Originally Posted by ranchani (Post 79994)
yeah but i not sure where to give the statement and i hav tried everything

If you are not sure where to give the statement then can you show us your code?
Sorry to say, if you had tried everything you would have solved that problem.I do'nt think that you have tried everything.

ranchani 27Feb2011 00:17

Re: get a msg that "ID ALREADY EXIST"
 
Code:

Imports System.Data
Imports System.Data.OleDb

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack = True Then
            Reset()
        End If
    End Sub


Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click

        Dim con As New OleDbConnection
        Dim com As New OleDbCommand
        Dim sqlString, STID, STNAME, AGE, ADMNO, FNAME, MNAME, BATCH, ADDRESS, PHNO, MOBNO, EMAIL As String

        STID = TextBox1.Text
        STNAME = TextBox2.Text
        AGE = TextBox3.Text
        ADMNO = TextBox4.Text
        FNAME = TextBox5.Text
        MNAME = TextBox6.Text
        BATCH = TextBox7.Text
        ADDRESS = TextBox8.Text
        PHNO = TextBox9.Text
        MOBNO = TextBox10.Text
        EMAIL = TextBox13.Text


        con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Varsha\My music\Visual Studio 2005\WebSites\PSA\App_Data\student.mdb")
        con.Open()
        sqlString = "insert into Table1 values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox13.Text & "')"
        com = New OleDbCommand(sqlString, con)
        com.ExecuteNonQuery()
        MsgBox("Data is successfully entered")
        con.Close()


    End Sub



All times are GMT +5.5. The time now is 04:32.