Click here to Skip to main content
15,891,976 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionControling aspx visibility Pin
aransiola17-May-07 10:20
aransiola17-May-07 10:20 
QuestionCompare validator not working Pin
aransiola17-May-07 10:08
aransiola17-May-07 10:08 
AnswerRe: Compare validator not working Pin
Jagadeesh Jupalli17-May-07 20:05
Jagadeesh Jupalli17-May-07 20:05 
QuestionMultiple email attachment in asp.net Pin
aransiola17-May-07 10:03
aransiola17-May-07 10:03 
AnswerRe: Multiple email attachment in asp.net Pin
Not Active17-May-07 11:51
mentorNot Active17-May-07 11:51 
QuestionXP Style Icons Pin
martin_hughes17-May-07 9:37
martin_hughes17-May-07 9:37 
AnswerRe: XP Style Icons Pin
Sathesh Sakthivel17-May-07 15:15
Sathesh Sakthivel17-May-07 15:15 
Questionfind duplicate keys Pin
seemamltn17-May-07 9:23
seemamltn17-May-07 9:23 
Hi,

I have dropdownlist named ddlapplication in my web form. When I click any item it insert
that record in database with primary key and show in gridview.
If user try to add the same record next time by clicking same item from the dropdown list
which already exist in database it should show error message that this
record alredy exist or in other words before inserting it should check wheather the record is already in database or not.

How can I do that. Here is my code

string str1 = this.ddlApplication.DataTextField;
string str2 = this.ddlApplication.SelectedValue;
string str3 = this.ddlPermission.SelectedItem.Value;


String constr = System.Configuration.ConfigurationManager.ConnectionStrings["twcsanConnectionString"].ConnectionString;
SqlConnection objConn = new SqlConnection(constr);
SqlCommand objCmd = new SqlCommand("INSERT INTO tbUsersAppRights(AppId, AppRightId, UserId) " +
"VALUES (@str1,@str2,@str3)", objConn);
objCmd.Parameters.AddWithValue("@str1", int.Parse(this.ddlApplication.SelectedValue));
objCmd.Parameters.AddWithValue("@str2", int.Parse(this.ddlPermission.SelectedValue));
objCmd.Parameters.AddWithValue("@str3", int.Parse(this.lblUserid11.Text));

objConn.Open();
objCmd.ExecuteNonQuery();
objConn.Close();
this.gdAddUser.DataBind();


seema

AnswerRe: find duplicate keys Pin
Tarakeshwar Reddy17-May-07 9:30
professionalTarakeshwar Reddy17-May-07 9:30 
QuestionFile Upload Pin
vasini17-May-07 9:12
vasini17-May-07 9:12 
AnswerRe: File Upload Pin
Parwej Ahamad17-May-07 18:03
professionalParwej Ahamad17-May-07 18:03 
GeneralRe: File Upload Pin
BINOVAR17-May-07 19:50
BINOVAR17-May-07 19:50 
QuestionAre there any cool websites created entirely using Visual Studio .Net 2005 Asp.net 2.0?? Pin
Nada Adel17-May-07 8:06
Nada Adel17-May-07 8:06 
AnswerRe: Are there any cool websites created entirely using Visual Studio .Net 2005 Asp.net 2.0?? Pin
Not Active17-May-07 8:35
mentorNot Active17-May-07 8:35 
QuestionServer agent has timed out when exporting crystal report to pdf format Pin
Deepthi Viswanathan Nair17-May-07 7:18
Deepthi Viswanathan Nair17-May-07 7:18 
Questionmake invisible browser(IE) Pin
sonia_basangar17-May-07 7:01
sonia_basangar17-May-07 7:01 
AnswerRe: make invisible browser(IE) Pin
Deepthi Viswanathan Nair17-May-07 7:23
Deepthi Viswanathan Nair17-May-07 7:23 
GeneralRe: make invisible browser(IE) Pin
sonia_basangar17-May-07 22:09
sonia_basangar17-May-07 22:09 
AnswerRe: make invisible browser(IE) Pin
Parwej Ahamad17-May-07 18:08
professionalParwej Ahamad17-May-07 18:08 
QuestionData Type Pin
seemamltn17-May-07 6:54
seemamltn17-May-07 6:54 
AnswerRe: Data Type Pin
Tarakeshwar Reddy17-May-07 7:23
professionalTarakeshwar Reddy17-May-07 7:23 
GeneralRe: Data Type Pin
seemamltn17-May-07 8:00
seemamltn17-May-07 8:00 
GeneralRe: Data Type Pin
Not Active17-May-07 8:33
mentorNot Active17-May-07 8:33 
AnswerRe: Data Type Pin
Not Active17-May-07 7:48
mentorNot Active17-May-07 7:48 
QuestionExport to excel Sheet Pin
seemamltn17-May-07 6:50
seemamltn17-May-07 6:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.