Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 prevent duplicate report names to be added

Author  Topic 

odeh83
Starting Member

8 Posts

Posted - 2006-04-25 : 02:06:23
guys how do i prevent duplicate names to be added from a textbox into a database? this is my code but it is not working, i'm using SQL & VB.NET:

Dim d As Integer
Dim dupl As Integer
dupl = "select count (*) from RPTPARAM"
For d = 0 To dupl - 1
If TextBox.Text = "RPTNAME" Then
MsgBox("Cannot Have Duplicate Values", MsgBoxStyle.Critical)
End If
Next

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-25 : 02:18:37
the query should be somthing like this..

Select Count(1) From RPTPARAM where [Name] = '"&TextBox.Text&"'"


If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-25 : 02:22:27
Also you need to make data reader or data adapter to get the value returned from Database

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

odeh83
Starting Member

8 Posts

Posted - 2006-04-25 : 02:33:58
thanx guys, but how do i use the data reader or data adapter to make it work? I'm a bit new to this stuff, plz could u help me further on this??
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-25 : 02:38:34
This is SQL Server forum. Do a google search and you can find more articles

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-25 : 02:43:29
search on MSDN forums..

http://forums.microsoft.com/MSDN/default.aspx?SiteID=1

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

odeh83
Starting Member

8 Posts

Posted - 2006-04-25 : 02:45:49
ok guys, thanx 4 ur help, appreciate it :)
Go to Top of Page
   

- Advertisement -