16,016,750 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ashutosh Dutondkar (Top 39 by date)
Ashutosh Dutondkar
1-Mar-16 8:58am
View
I tried inserting breakpoint on form load GlobalVariable.IsAdmin = True then first time after the click off Login Button its making the condition as,
GlobalVariable.IsAdmin = False but aftr closing the form and opening the same form again its not able to check condition and the condition is same as GlobalVariable.IsAdmin = True. Also if I try to keep condition GlobalVariable.IsAdmin = False first time its keeping it False only but after that being the condition is False then too the buttons are getting enable.
Ashutosh Dutondkar
29-Feb-16 14:11pm
View
I tried, but the condition is Still the same. Its checking only on Login button click.
I checked the condition on form load like GlobalVariable.IsAdmin = True but its not checking condition on form load. Still if employee logs in first time it checks the other time buttons are enabled
Ashutosh Dutondkar
29-Feb-16 13:25pm
View
I don't want two forms for ADMIN and EMPLOYEE. It should be checked on same form. I don;t have doubt in my code, because its working properly! Just I want to know how can i declare it globally! So I can check it on other forms! I have table in my database with columns username, password and type. Type has two rows "ADMIN" and "EMPLOYEE"
Ashutosh Dutondkar
29-Feb-16 12:54pm
View
But how should I implement my above code in the solution. I'm unable to do the coding. Please help me with the implementation of above code!
Ashutosh Dutondkar
29-Feb-16 10:36am
View
I have try doing above code. Its working all right but when form is Close and Open the Buttons are enable. I dont know how to declare global variables in VB.NET please help me with the code how to declare globally so I can use it on other fomrs as well.
Ashutosh Dutondkar
25-Feb-16 8:39am
View
Sorry RyanDev! But m not able to do it. Please can you help me Editing my given code! Making Global Variables in it! It will help me alot Sir!
Ashutosh Dutondkar
23-Feb-16 20:36pm
View
Actually I have tried the above coding so far and I m not so good in VB. Can you please help me to declare them globally. I mean how to save their access and declare them globally. I'll be very thankful if you help me with the same.
Ashutosh Dutondkar
23-Feb-16 20:36pm
View
Deleted
Actually I have tried the above coding so far and I m not so good in VB. Can you please help me to declare them globally. I mean how to save their access and declare them globally. I'll be very thankful if you help me with the same.
Ashutosh Dutondkar
7-Feb-16 10:18am
View
Oops I'm Sorry!
Private Sub coursenamecmb_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles coursenamecmb.SelectedIndexChanged
Dim com As SqlCommand
Dim dr As SqlDataReader
Try
con.Open() // Here the error is 'The connection <pre>was not closed. The connection's current state is open.'
Dim str As String
str = "Select ccoursename, stfstaffid, stfname, stfsurname from CoursesStaff where ccoursename like '" & coursenamecmb.Text & "'"
com = New SqlCommand(str, con)
dr = com.ExecuteReader
While dr.Read
coursenamecmb.Text = dr.GetString(0)
staffidcmb.Text = dr.GetValue(1)
stfnametxt.Text = dr.GetValue(2)
stflnametxt.Text = dr.GetValue(3)
End While
con.Close()
Catch ex As SqlException
MessageBox.Show(ex.Message)
End Try
End Sub
Ashutosh Dutondkar
7-Feb-16 5:07am
View
m trying to do this because i have Batches Table in which their is a BatchID coloumn so if sometime i need to change the batchid then it would be helpfull to me.
Ashutosh Dutondkar
7-Feb-16 4:17am
View
Thats what i wanted to know that changing Primary Key would be right! When i try to update it jst display the message box "Record Updated" which i have used when the record is updated!
Ashutosh Dutondkar
7-Feb-16 4:00am
View
I tried putting the sstudentid in SET clause but then too it is not getting update!
Ashutosh Dutondkar
7-Feb-16 2:15am
View
I tried doing that but it gives same error.
Ashutosh Dutondkar
31-Jan-16 2:39am
View
Please Help Me Sir.. Its very important to me and urgent to me. PLEASE HELP SIR.
Ashutosh Dutondkar
30-Jan-16 14:51pm
View
The option is already ticked. Please provide me with your EmailID i can explain you my exact problem.
Ashutosh Dutondkar
30-Jan-16 13:03pm
View
If you can provide me with your MailID then i can tell about my error much better!
Ashutosh Dutondkar
30-Jan-16 13:02pm
View
Visual Studio 2010 Professional and SQL Server 2012
Ashutosh Dutondkar
30-Jan-16 9:18am
View
I have ComboBox, CheckBox in DataGridView and everything m doin at runtime. I had different services in datagridview and products in combobox aftr selecting the service and products from the combobox, the price of both of them is added and displayed in label. But aftr clicking OK button m receiving an error. Please Help Me m trying to solve it from long time but i couldn't. HELP ME OUT IN THIS.
Ashutosh Dutondkar
30-Jan-16 9:14am
View
Also m transferring the Checkbox selected data in other form on click of OK button, when i click OK button the above error is coming.
Ashutosh Dutondkar
30-Jan-16 9:13am
View
m not getting the line on which the error is occuring but the error is which is shown above
Ashutosh Dutondkar
30-Jan-16 9:12am
View
The Error is 'The Following Exception Occured in The Datagirdview. System.Arguement.Exception: DatagridviewCellCombobox value is not valid. To replace this dialog please handle the DataError Event'. After this one more error is System.IndexOutOfRangeException: Index 0 does not have value. at System.Windows.Forms.CurrencyManager.get_Item(Int32 index) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetError(int32 rowindex)
To replace this default dialog please handle the DataError event
Ashutosh Dutondkar
30-Jan-16 9:11am
View
Deleted
The Error is 'The Following Exception Occured in The Datagirdview. System.Arguement.Exception: DatagridviewCellCombobox value is not valid. To replace this dialog please handle the DataError Event'. After this one more error is System.IndexOutOfRangeException: Index 0 does not have value. at System.Windows.Forms.CurrencyManager.get_Item(Int32 index) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetError(int32 rowindex)
To replace this default dialog please handle the DataError event
Ashutosh Dutondkar
15-Jan-16 12:42pm
View
Also it taught many things to me. :)
Ashutosh Dutondkar
15-Jan-16 12:41pm
View
Your solution worked for me. Very much thankful to you, i was struggling with this from 2 days which help me out today. Also your code taught me about SQL Injection Attacks, thank you sou much! :)
Ashutosh Dutondkar
11-Jan-16 13:29pm
View
One more thing please! I have datagirdview in my WinForms and in which i have checkbox column, and other two columns with service name and total. When i will check the check box in gird view i want to display the service name and total in the next forms listbox on click of 'OK' button! M not getting how to do it, please help me with it!
Ashutosh Dutondkar
10-Jan-16 14:04pm
View
thanks it helped me again! :) Now the validation are working properly!
Ashutosh Dutondkar
9-Jan-16 15:36pm
View
One more doubt! M checking validate fields! like contact number , age, email etc. So, if i entered wrong data and click insert button it is validating me but the problem is after correcting the field the data is getting inserted 2 times because i have press insert 2 times! As many time if i will press insert button because of validation that many times the data is getting inserted
Ashutosh Dutondkar
9-Jan-16 15:33pm
View
If Not CheckEmptyTextbox(GroupBox1) Then
Exit Sub
End If
'Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True")
Dim com As SqlCommand
Dim com1 As New SqlCommand
Dim str As String
Dim str1 As String
Dim i = Convert.ToInt32(stuidcmb.Text)
Dim a = Convert.ToInt32(stuagetxt.Text)
Dim gender As String = String.Empty
If stumalerd.Checked Then
gender = "Male"
ElseIf stufemalerd.Checked Then
gender = "Female"
End If
' Try
con.Open()
str = "Insert into StudentRegister values (@sstudentid,@sname,@smiddlename,@ssurname,@sdob,@ccoursename,@btbatchid,@sage,@sgender,@scontact,@saddress,@semailid,@sdatereg)"
com = New SqlCommand(str, con)
com.Parameters.AddWithValue("@sstudentid", i)
com.Parameters.AddWithValue("@sname", stufnametxt.Text)
com.Parameters.AddWithValue("@smiddlename", stumnametxt.Text)
com.Parameters.AddWithValue("@ssurname", stulnametxt.Text)
com.Parameters.AddWithValue("@sdob", DateTimePicker2.Value.Date)
com.Parameters.AddWithValue("@ccoursename", coursenamecmb.Text)
com.Parameters.AddWithValue("@btbatchid", batchidcmb.Text)
com.Parameters.AddWithValue("@sage", a)
com.Parameters.AddWithValue("@sgender", gender)
com.Parameters.AddWithValue("@scontact", stucntcttxt.Text)
com.Parameters.AddWithValue("@saddress", stuaddtxt.Text)
com.Parameters.AddWithValue("@semailid", stuemailtxt.Text)
com.Parameters.AddWithValue("@sdatereg", DateTimePicker1.Value.Date)
com.CommandText = str
com.ExecuteNonQuery()
con.Close()
If stucntcttxt.Text.Length <> 10 Then
MsgBox("Contact Number Must Be 10 Characters Long", MsgBoxStyle.Information)
Exit Sub
End If
If EmailAddressCheck(stuemailtxt.Text) = True Then
MsgBox("Please enter your email address correctly", vbInformation)
stuemailtxt.Text = ""
Exit Sub
End If
con.Open()
str1 = "Insert into AttendanceStudent values (@sstudentid,@sname,@btbatchid,@ccoursename,@atsdate,'ABSENT')"
com1 = New SqlCommand(str1, con)
com1.Parameters.AddWithValue("@sstudentid", i)
com1.Parameters.AddWithValue("@sname", stufnametxt.Text)
com1.Parameters.AddWithValue("@btbatchid", batchidcmb.Text)
com1.Parameters.AddWithValue("@ccoursename", coursenamecmb.Text)
com1.Parameters.AddWithValue("@atsdate", DateTimePicker1.Value.Date)
com1.CommandText = str1
com1.ExecuteNonQuery()
con.Close()
MsgBox("Record Inserted Successfully", MsgBoxStyle.Information)
Display()
clear()
'Catch ex As Exception
'End Try
End Sub
Ashutosh Dutondkar
9-Jan-16 15:11pm
View
Thank you so much! Now its not giving me an error! Thank you very much! +10! :);)
Ashutosh Dutondkar
28-Dec-15 12:55pm
View
Okay! thank you so much. I'll see forward for it :)
Ashutosh Dutondkar
27-Dec-15 4:56am
View
Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True")
Dim com As SqlCommand
Dim str As String
Dim i = CInt(stuidcmb.Text)
Dim a = CInt(stuagetxt.Text)
Dim d As Date = DateTime.Parse(studobtxt.Text)
Dim gender As String = String.Empty
If stumalerd.Checked Then
gender = "Male"
ElseIf stufemalerd.Checked Then
gender = "Female"
End If
Try
con.Open()
str = "Insert into StudentRegister values (@sstudentid,@sname,@smiddlename,@ssurname,@sdob,@ccoursename,@btbatchid,@sage,@sgender,@scontact,@saddress,@scity,@sstate,@spincode,@semailid)"
com = New SqlCommand(str, con)
com.Parameters.AddWithValue("@sstudentid", i)
com.Parameters.AddWithValue("@sname", stufnametxt.Text)
com.Parameters.AddWithValue("@smiddlename", stumnametxt.Text)
com.Parameters.AddWithValue("@ssurname", stulnametxt.Text)
com.Parameters.AddWithValue("@sdob", d)
com.Parameters.AddWithValue("@ccoursename", coursenamecmb.Text)
com.Parameters.AddWithValue("@btbatchid", batchidcmb.Text)
com.Parameters.AddWithValue("@sage", a)
com.Parameters.AddWithValue("@sgender", gender)
com.Parameters.AddWithValue("@scontact", stucntcttxt.Text)
com.Parameters.AddWithValue("@saddress", stuaddtxt.Text)
com.Parameters.AddWithValue("@scity", stucitytxt.Text)
com.Parameters.AddWithValue("@sstate", stustatetxt.Text)
com.Parameters.AddWithValue("@spincode", stupintxt.Text)
com.Parameters.AddWithValue("@semailid", stuemailtxt.Text)
com.CommandText = str
com.ExecuteNonQuery()
Catch ex As Exception
End Try
MsgBox("Record Inserted Successfully", MsgBoxStyle.Information)
Display()
clear()
con.Close()
IS THIS CODE OF MINE IS ALSO OPENED FOR SQL INJECTION ATTACKS? PLEASE HELP ME WITH THE SAME HOW TO USE PARAMETRIZED QUERY AND AVOID ATTACKS ON MY DTATBASE.
Ashutosh Dutondkar
27-Dec-15 4:55am
View
Deleted
Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True")
Dim com As SqlCommand
Dim str As String
Dim i = CInt(stuidcmb.Text)
Dim a = CInt(stuagetxt.Text)
Dim d As Date = DateTime.Parse(studobtxt.Text)
Dim gender As String = String.Empty
If stumalerd.Checked Then
gender = "Male"
ElseIf stufemalerd.Checked Then
gender = "Female"
End If
Try
con.Open()
str = "Insert into StudentRegister values (@sstudentid,@sname,@smiddlename,@ssurname,@sdob,@ccoursename,@btbatchid,@sage,@sgender,@scontact,@saddress,@scity,@sstate,@spincode,@semailid)"
com = New SqlCommand(str, con)
com.Parameters.AddWithValue("@sstudentid", i)
com.Parameters.AddWithValue("@sname", stufnametxt.Text)
com.Parameters.AddWithValue("@smiddlename", stumnametxt.Text)
com.Parameters.AddWithValue("@ssurname", stulnametxt.Text)
com.Parameters.AddWithValue("@sdob", d)
com.Parameters.AddWithValue("@ccoursename", coursenamecmb.Text)
com.Parameters.AddWithValue("@btbatchid", batchidcmb.Text)
com.Parameters.AddWithValue("@sage", a)
com.Parameters.AddWithValue("@sgender", gender)
com.Parameters.AddWithValue("@scontact", stucntcttxt.Text)
com.Parameters.AddWithValue("@saddress", stuaddtxt.Text)
com.Parameters.AddWithValue("@scity", stucitytxt.Text)
com.Parameters.AddWithValue("@sstate", stustatetxt.Text)
com.Parameters.AddWithValue("@spincode", stupintxt.Text)
com.Parameters.AddWithValue("@semailid", stuemailtxt.Text)
com.CommandText = str
com.ExecuteNonQuery()
Catch ex As Exception
End Try
MsgBox("Record Inserted Successfully", MsgBoxStyle.Information)
Display()
clear()
con.Close()
IS THIS CODE OF MINE IS ALSO OPENED FOR SQL INJECTION ATTACKS? PLEASE HELP ME WITH THE SAME HOW TO USE PARAMETRIZED QUERY AND AVOID ATTACKS ON MY DTATBASE.
Ashutosh Dutondkar
27-Dec-15 4:45am
View
Actually, my mistake was, I was having a numeric data type and was trying to convert to string by putting ''. But instead of '=' is I have put 'like' command for comparing the string and my error is solved now. Thanks for your Help Sir! :)
Ashutosh Dutondkar
26-Dec-15 2:12am
View
No Sir! Its not like that but i have not work on DataGridView so m not getting what to do!
Ashutosh Dutondkar
26-Dec-15 2:08am
View
Private Sub btstfidcmb_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles btstfidcmb.SelectedIndexChanged
Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True")
Dim com As SqlCommand
Dim dr As SqlDataReader
Try
con.Open()
Dim str As String
str = "select * from StaffRegister where stfstaffid = '" & btstfidcmb.Text & "'"
com = New SqlCommand(str, con)
dr = com.ExecuteReader
While dr.Read 'GETTING ERROR ON THIS LINE'
stfnametxt.Text = dr.GetString(1)
stfmnametxt.Text = dr.GetString(2)
stflnametxt.Text = dr.GetString(3)
End While
con.Close()
Catch ex As SqlException
MessageBox.Show(ex.Message)
End Try
End Sub
Actually, m facing an error on line while dr.Read when i attempt to close the form with the form close icon on the form. The code is working properly but when I close the form it gives me the error "ERROR CONVERTING DATATYPE VARCHAR TO NUMERIC" i tried many things but the error is not getting solved. Can u please help me with this also?
Ashutosh Dutondkar
26-Dec-15 2:03am
View
Thank you so much Sir! For your help, now the code is working.
Ashutosh Dutondkar
26-Dec-15 1:59am
View
Actually i havn't did this type so far and m also beginner in vb, nt exaclty beginner bt have learned many thing. this thing is something new to me, so please can you help me with the code. M not getting what to write in the coding section.
Ashutosh Dutondkar
25-Dec-15 14:14pm
View
I aslo tried using integer index value but then it gives me some other error like error converting System.String To System.Decimal
Ashutosh Dutondkar
25-Dec-15 14:06pm
View
error is on line coursenamecmb.Text = dr.GetString("ccoursename")
Show More