Click here to Skip to main content
16,014,392 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Handling exception in a better way Pin
Luc Pattyn23-Jul-10 2:56
sitebuilderLuc Pattyn23-Jul-10 2:56 
QuestionMessage Removed Pin
21-Jul-10 21:21
sr15921-Jul-10 21:21 
AnswerRe: problem in creating organisation chart from Mysql database using C#, ASP.net [Repost] Pin
Richard MacCutchan21-Jul-10 21:34
mveRichard MacCutchan21-Jul-10 21:34 
QuestionUnable to use array for control Pin
souvikd21-Jul-10 10:07
souvikd21-Jul-10 10:07 
AnswerRe: Unable to use array for control Pin
Abhinav S21-Jul-10 18:41
Abhinav S21-Jul-10 18:41 
AnswerRe: Unable to use array for control Pin
Roger Wright21-Jul-10 19:45
professionalRoger Wright21-Jul-10 19:45 
AnswerRe: Unable to use array for control Pin
Goutam Patra21-Jul-10 22:20
professionalGoutam Patra21-Jul-10 22:20 
GeneralRe: Unable to use array for control Pin
souvikd21-Jul-10 23:18
souvikd21-Jul-10 23:18 
Hi ,
as i have already informed, i am trying to insert multiple user details to two different tables using a stored procedure from one form, after the successful execution of the query i want to clear the controls.
Please see code to get is clarified

Private Sub btnSubmit_CrtMul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit_CrtMul.Click
Dim cnt As Integer = 0

Try

If chkBox1_Crtusr.Checked Then
rtrnQry(txtUsrNm_1.Text, txtPswd_1.Text, txtFName_1.Text, txtLName_1.Text, txtEmpID_1.Text, cmbProNm1.SelectedItem, cmbAdmin1.SelectedItem, 1)

' After the statement gets executed i want to clear all the controls using array control list or by any ' other option
Dim sqlLogin As String = "Select * from login where user_name ='" & txtUsrNm_1.Text & "'"
Dim usrVerified As String = DataStore.ExecuteScalar(sqlLogin, sqlConnStr)
If usrVerified.Length > 0 Then
chkBox1_Crtusr.CheckState = CheckState.Unchecked
txtUsrNm_1.Text = ""
txtPswd_1.Text = ""
txtFName_1.Text = ""
txtLName_1.Text = ""
txtEmpID_1.Text = ""
cmbProNm1.SelectedIndex = -1 ' project name
cmbAdmin1.SelectedIndex = -1 ' Admin privilege (boolean value)
cnt = cnt + 1
End If
End If

If chkBox2_Crtusr.Checked Then
rtrnQry(txtUsrNm_2.Text, txtPswd_2.Text, txtFName_2.Text, txtLName_2.Text, txtEmpID_2.Text, cmbProNm2.SelectedItem, cmbAdmin2.SelectedItem, 2)
Dim sqlLogin As String = "Select * from login where user_name ='" & txtUsrNm_2.Text & "'"
Dim usrVerified As String = DataStore.ExecuteScalar(sqlLogin, sqlConnStr)
If usrVerified.Length > 0 Then
chkBox2_Crtusr.CheckState = CheckState.Unchecked
txtUsrNm_2.Text = ""
txtPswd_2.Text = ""
txtFName_2.Text = ""
txtLName_2.Text = ""
txtEmpID_2.Text = ""
cmbProNm2.SelectedIndex = -1
cmbAdmin2.SelectedIndex = -1
cnt = cnt + 1
End If
End If

If chkBox3_Crtusr.Checked Then
rtrnQry(txtUsrNm_3.Text, txtPswd_3.Text, txtFName_3.Text, txtLName_3.Text, txtEmpID_3.Text, cmbProNm3.SelectedItem, cmbAdmin3.SelectedItem, 3)
Dim sqlLogin As String = "Select * from login where user_name ='" & txtUsrNm_3.Text & "'"
Dim usrVerified As String = DataStore.ExecuteScalar(sqlLogin, sqlConnStr)
If usrVerified.Length > 0 Then
chkBox3_Crtusr.CheckState = CheckState.Unchecked
txtUsrNm_3.Text = ""
txtPswd_3.Text = ""
txtFName_3.Text = ""
txtLName_3.Text = ""
txtEmpID_3.Text = ""
cmbProNm3.SelectedIndex = -1
cmbAdmin3.SelectedIndex = -1
cnt = cnt + 1
End If
End If

If chkBox4_Crtusr.Checked Then
rtrnQry(txtUsrNm_4.Text, txtPswd_4.Text, txtFName_4.Text, txtLName_4.Text, txtEmpID_4.Text, cmbProNm4.SelectedItem, cmbAdmin4.SelectedItem, 4)
Dim sqlLogin As String = "Select * from login where user_name ='" & txtUsrNm_4.Text & "'"
Dim usrVerified As String = DataStore.ExecuteScalar(sqlLogin, sqlConnStr)
If usrVerified.Length > 0 Then
chkBox4_Crtusr.CheckState = CheckState.Unchecked
txtUsrNm_4.Text = ""
txtPswd_4.Text = ""
txtFName_4.Text = ""
txtLName_4.Text = ""
txtEmpID_4.Text = ""
cmbProNm4.SelectedIndex = -1
cmbAdmin4.SelectedIndex = -1
cnt = cnt + 1
End If
End If

If chkBox5_Crtusr.Checked Then
rtrnQry(txtUsrNm_5.Text, txtPswd_5.Text, txtFName_5.Text, txtLName_5.Text, txtEmpID_5.Text, cmbProNm5.SelectedItem, cmbAdmin5.SelectedItem, 5)
Dim sqlLogin As String = "Select * from login where user_name ='" & txtUsrNm_5.Text & "'"
Dim usrVerified As String = DataStore.ExecuteScalar(sqlLogin, sqlConnStr)
If usrVerified.Length > 0 Then
chkBox5_Crtusr.CheckState = CheckState.Unchecked
txtUsrNm_5.Text = ""
txtPswd_5.Text = ""
txtFName_5.Text = ""
txtLName_5.Text = ""
txtEmpID_5.Text = ""
cmbProNm5.SelectedIndex = -1
cmbAdmin5.SelectedIndex = -1
cnt = cnt + 1
End If
End If

Catch ex As SqlException
MsgBox(ex.ToString)
End Try
MsgBox("Number of user inserted successfully is : " & cnt, MsgBoxStyle.Information, "Multi User Insert Information")

End Sub

Public Sub rtrnQry(ByVal usrNm As String, ByVal psWd As String, ByVal fNm As String, _
ByVal lNm As String, ByVal empId As Integer, ByVal proNm As String, ByVal aDm As String, ByVal rowno As Integer)
Try

Using cn As New SqlConnection(sqlConnStr)
cn.Open()
Using cmd As New SqlCommand("InsrtLogin", cn)
With cmd
.CommandType = CommandType.StoredProcedure
.Parameters.AddWithValue("@empid", empId)
.Parameters.AddWithValue("@username", usrNm)
.Parameters.AddWithValue("@password", psWd)
.Parameters.AddWithValue("@firstname", fNm)
.Parameters.AddWithValue("@lastname", lNm)
.Parameters.AddWithValue("@adminpri", aDm)
.Parameters.AddWithValue("@proName", proNm)
.ExecuteNonQuery()
End With
End Using
End Using

Catch ex As SqlException
msgbox(ex.tostring)

End Try
End Sub
GeneralRe: Unable to use array for control Pin
Goutam Patra21-Jul-10 23:38
professionalGoutam Patra21-Jul-10 23:38 
GeneralRe: Unable to use array for control Pin
souvikd22-Jul-10 0:45
souvikd22-Jul-10 0:45 
GeneralRe: Unable to use array for control Pin
Goutam Patra22-Jul-10 1:21
professionalGoutam Patra22-Jul-10 1:21 
GeneralRe: Unable to use array for control Pin
souvikd22-Jul-10 18:25
souvikd22-Jul-10 18:25 
AnswerRe: Unable to use array for control Pin
gargagan26-Jul-10 5:57
gargagan26-Jul-10 5:57 
QuestionClickOnce InvalidDeploymentException Pin
agent00zelda21-Jul-10 7:59
agent00zelda21-Jul-10 7:59 
AnswerRe: ClickOnce InvalidDeploymentException Pin
Peace ON22-Jul-10 20:27
Peace ON22-Jul-10 20:27 
QuestionGridview values not save on postback Pin
Clint Westwood21-Jul-10 5:20
Clint Westwood21-Jul-10 5:20 
AnswerRe: Gridview values not save on postback Pin
Not Active21-Jul-10 8:58
mentorNot Active21-Jul-10 8:58 
Questionhow to create web organisation chart using mysql database in C#, ASP.net Pin
sr15921-Jul-10 2:47
sr15921-Jul-10 2:47 
AnswerRe: how to create web organisation chart using mysql database in C#, ASP.net Pin
Abhinav S21-Jul-10 3:36
Abhinav S21-Jul-10 3:36 
QuestionAnybody knows the proper website link of downloading and creating the web employee organisation chart application dynamically using mysql database in C#, ASP.net [modified] Pin
sr15921-Jul-10 18:53
sr15921-Jul-10 18:53 
Questionasp.net Pin
mudassir 198820-Jul-10 20:06
mudassir 198820-Jul-10 20:06 
AnswerRe: asp.net Pin
Richard MacCutchan20-Jul-10 21:32
mveRichard MacCutchan20-Jul-10 21:32 
AnswerRe: asp.net Pin
Abhinav S21-Jul-10 18:41
Abhinav S21-Jul-10 18:41 
Questionproblem in restoring mysql dump file using C#.net Pin
sr15920-Jul-10 1:10
sr15920-Jul-10 1:10 
AnswerRe: problem in restoring mysql dump file using C#.net Pin
Richard MacCutchan20-Jul-10 2:09
mveRichard MacCutchan20-Jul-10 2:09 

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.