15,912,507 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 Python 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 Akaglo (Top 40 by date)
Akaglo
15-May-13 9:42am
View
Thanks a lot, but your suggestion is still not working for me. The AutoComplete TextBox is supposed to retrieve the data from a database.
Akaglo
29-Mar-13 6:33am
View
Thank you, Sir. I've checked the link, but that's not what I want exactly. For my problem, I want the data in the textbox to come from a table in the database.
Akaglo
28-Mar-13 10:30am
View
Can you please show me that?
Akaglo
26-Mar-13 5:43am
View
I've checked the links. Even though the samples look fine they don't seem to give me exactly what I want. The issue is that I want a code that will enable data on a row to appear in the text boxes when the user clicks on the row in the GridView, to perform update. The code above does exactly this in my Windows application and I want same in the Web application.
Akaglo
25-Mar-13 10:03am
View
CHill60, I've checked the links but both didn't seem to give the right solution. I'd therefore be happy if you could modify my code to resolve the problem in question. Thank you in advance.
Akaglo
23-Mar-13 16:39pm
View
I've removed the repeated line of code and what is happening is that the grid now appears but can't display data in columns
Akaglo
14-Feb-13 16:07pm
View
Please Sir, kindly solve the problem for me.
Akaglo
14-Feb-13 15:47pm
View
Please I'd be grateful if you could try to edit the code to solve the whole problem.
Akaglo
14-Feb-13 6:05am
View
Please Sir, I have posted a question on Deleting a record from multiple tables. Kindly attend to it out for.
Akaglo
14-Feb-13 5:41am
View
My main concern is the following line of code: ProgramDetails.EnglishLanguage. How I do represent all the subjects by a variable or something as though all the subjects table are one table.Since it would not be appropriate to write something like ProgramDetails.EnglishLanguage, ProgramDetails.Mathematics, ProgramDetails.French, etc
Akaglo
8-Feb-13 5:06am
View
Sir, kindly review the following code for me. The update command executes but no update takes place.
If Not bError Then
sbQry.Append("Update StaffDetails.Staff set StaffID=@StaffID,EmployeeName=@EmployeeName,SSN=@SSN,Day=@Day,Month=@Month,Year=@Year,Sex=@Sex,Qualifications=@Qualifications,Rank=@Rank,Responsibility=@Responsibility,ApDay=@ApDay,ApMonth=@ApMonth,ApYear=@ApYear,RegNumber=@RegNumber,Phone=@Phone,Email=@Email,Status=@Status")
If img IsNot Nothing Then
sbQry.Append(",Photo=@Photo")
End If
sbQry.Append(" where Number='").Append(txtNo.Text).Append("'")
cmd = New SqlCommand(sbQry.ToString, cn)
cmd.Parameters.Add(New SqlParameter("@StaffID", txtNo.Text))
cmd.Parameters.Add(New SqlParameter("@StaffID", txtStaffID.Text))
cmd.Parameters.Add(New SqlParameter("@EmployeeName", txtName.Text))
cmd.Parameters.Add(New SqlParameter("@SSN", txtSsNumber.Text))
cmd.Parameters.Add(New SqlParameter("@Day", cboDay.Text))
cmd.Parameters.Add(New SqlParameter("@Month", cboMonth.Text))
cmd.Parameters.Add(New SqlParameter("@Year", txtYear.Text))
cmd.Parameters.Add(New SqlParameter("@Sex", Sex))
cmd.Parameters.Add(New SqlParameter("@Qualifications", txtQualifications.Text))
cmd.Parameters.Add(New SqlParameter("@Rank", txtRank.Text))
cmd.Parameters.Add(New SqlParameter("@Responsibility", txtRespons.Text))
cmd.Parameters.Add(New SqlParameter("@ApDay", cboApDay.Text))
cmd.Parameters.Add(New SqlParameter("@ApMonth", cboApMonth.Text))
cmd.Parameters.Add(New SqlParameter("@ApYear", txtApYear.Text))
cmd.Parameters.Add(New SqlParameter("@RegNumber", txtRegdNum.Text))
cmd.Parameters.Add(New SqlParameter("@Phone", txtPhone.Text))
cmd.Parameters.Add(New SqlParameter("@Email", txtEmail.Text))
cmd.Parameters.Add(New SqlParameter("@Status", cboStatus.Text))
If img IsNot Nothing Then
cmd.Parameters.Add(New SqlParameter("@Photo", img))
End If
cmd.ExecuteNonQuery()
lblSave_Update.Text = "Record successfully updated"
End If
Showgrid()
Catch ex As Exception
MessageBox.Show(ex.Message)
Akaglo
8-Feb-13 4:53am
View
Deleted
Thank you so much, Sir. The problem is successfully resolved.
Akaglo
8-Feb-13 3:31am
View
Please if I parametrize it to be like IDNumber=@IDNumber the following I get the message: Must declare the scalar variable "@IDNumber". How do therefore declare it, please.
Akaglo
8-Feb-13 3:17am
View
Thank Sir, the problem has now solved, but I wish that you could show me how I can do away with & txtIDNumber.Text & by using a parameter. Even though the code now works fine what I've done is that I've set the Visible of txtIDNumber to False in the Property pane, to prevent the users from seeing the IsIdentity number. However, if I parametrize it to be like IDNumber=@IDNumber the following I get the message: Must declare the scalar variable "@IDNumber". How do therefore declare it, please?
Akaglo
7-Feb-13 18:08pm
View
Pls Sir, kindly check out another the following problem which I've posted on this site: "How do I update data that has its its primary key set to IsIdentity? "
Akaglo
7-Feb-13 17:44pm
View
"subject" is a variable name that holds subject type e.g. Elective or Core
Akaglo
29-Jan-13 16:33pm
View
Thank you, Sir. That's quite enough.
Akaglo
29-Jan-13 15:58pm
View
Now, I wish to extend the project by making it cover students’ financial records (billing application), such that it can as well be used to handle payment of fees. In this regard, since I wouldn’t want to mess up with the creation of the tables in the database, I’d be happier if you could very kindly give me recommendations regarding how I should create the tables. The following are the requirements specification of the billing application I intend to include in my school management application I’m developing.
1.Fees are paid every term (semester) according to program of study by a student. For example fees paid by general science students are different from that of general arts students.
2.Bills are to be given to students before fees are paid.
3.Bills should state the items and their corresponding prices as well as the grand total.
4.Bills should indicate whether a student has a debit or credit from the previous term (semester)
5. Receipt is to be printed when payment is made.
Akaglo
29-Jan-13 10:25am
View
Thank you, Sir.
Akaglo
29-Jan-13 10:12am
View
Yes Sir, I want a central database to hold the database.
Akaglo
29-Jan-13 9:23am
View
Sir Mike, I wish to ask you a different question, and that's the ConnectionString in my program is cn = New SqlConnection("Data Source=EBENEZERAKAGLO\SQLEXPRESS;Initial Catalog=Naass;Integrated Security=True") where the Data Source is my computer and that implies that the program can only be run on my computer. Could please teach me how to go about the connection such that the program can automatically connect to a database on any computer that has SQL Server installed when the program is finally compiled and installed?
Akaglo
29-Jan-13 7:51am
View
I'd keep contacting you for your generous assistance. My email address is: akaglosincerity@yahoo.com
Akaglo
29-Jan-13 7:47am
View
Alright Sir, Kudos you! You're a very kind and good teacher.
Akaglo
29-Jan-13 7:42am
View
Private Sub MarksEntryFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.MdiParent = MDI
subj = Module1.sname
subj1 = subj.Replace(" ", "")
subname = subj1
subname = Module1.sname
Akaglo
29-Jan-13 7:36am
View
Hurray!!! The problem is now solved. I'm so much thankful to you and may the Almighty God richly bless you for your generous assistance. I added subname = Module1.sname to the following
subj1 = subj.Replace(" ", "")
subname = subj1 in the Form_Load instead a replacement.
Akaglo
29-Jan-13 5:14am
View
Thank you so much for your good counsel. I have run the queries in SQL Server Management Studio and got the right results. What, however, beats me completely is that in the code in question, if a subject name without white space such as Biology, Mathematics, Physics, etc is selected the DataReader is able to read the corresponding subject code; but if a subject name with white space such as English Language, Social Studies,etc is selected the code doesn't even execute. Sir, I'm deeply worried about this problem because it's taking me too far.
Akaglo
28-Jan-13 18:14pm
View
The same old problem.
Akaglo
28-Jan-13 17:21pm
View
Exactly so; that is, I may need the subject code of English II but my query would get me that of English I.
Akaglo
28-Jan-13 17:01pm
View
In your case it seems there's always only one city name. In my case the DataReader should always read the subject code of any selected subject, be it Social Studies, English language, Biology, etc. That's my problem. My code is always reading subject codes of subjects whose names do not contain spaces.
Akaglo
28-Jan-13 16:54pm
View
Thanks so much for your attention.
Akaglo
28-Jan-13 16:51pm
View
Sir, the point is the embedded space has to be removed with this code
subj1 = subj.Replace(" ", "")
subname = subj1
on the Windows form where the code in question has to read the subject code
when login succeeds. The code that removes the embedded spaces is not used on the login form as shown to you above.
Akaglo
28-Jan-13 16:30pm
View
Alright Sir, I've also tried the following and it's only subject codes of subject names without space that is read by the DataReader.
cmd = New SqlCommand("select RTRIM(subjectCode) from ProgramDetails.subjects " + _
"where subjectname Like '" & Trim(subname) & "%'", cn)
dr = cmd.ExecuteReader
If dr.Read Then
subcode = dr(0)
End If
dr.Close()
Akaglo
28-Jan-13 16:24pm
View
Alright, the main issue is how do I replace "Social Studies" with something that will enable the reader read the subject code of any selected subject?" I've tried the following and when a subject with space is selected the code doesn't execute. cmd.Parameters.AddWithValue("@subname", subname)
Akaglo
28-Jan-13 16:09pm
View
One more issue, Sir, if I put for example English within the double quotes in line 4 of the code in question, as in cmd.Parameters.AddWithValue("@subname", String.Format("%{0}%", "English")), the DataReader is able to read the subject code of English Language; if replace English with Social, it is then able to read the subject code of Social Studies as well.
Akaglo
28-Jan-13 15:59pm
View
Yes to all three questions, Sir
Akaglo
28-Jan-13 15:50pm
View
There is a log on form that is used to log on to the Windows form where the code in question, is expected to work, with some specified user credential such as Term, Academic Year, Subject Name, User Name and Password as in the following:
Private Sub btnLogOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogOn.Click
Try
Dim frm As New MarksEntryFrm
Dim flag As Boolean
flag = False
f = cboForm.Text
ac = cboAcadYear.Text
t = cboTerm.Text
user = txtUserName.Text
password = txtPassword.Text
Module1.frm = cboForm.SelectedItem
Module1.uid = txtUserName.Text
Module1.pwd = txtPassword.Text
Module1.sname = cboSubjName.SelectedItem
Module1.term = cboTerm.SelectedItem
Module1.acadyear = cboAcadYear.SelectedItem
If String.IsNullOrEmpty(f) Or String.IsNullOrEmpty(ac) Or String.IsNullOrEmpty(t) Or String.IsNullOrEmpty(user) Or String.IsNullOrEmpty(password) Then
MessageBox.Show("Please all the fields must be entered", "", MessageBoxButtons.OK, MessageBoxIcon.Stop)
cboForm.Focus()
Else
Dim i As Integer = 0
cmd = New SqlCommand("Select c.Form,c.AcademicYear,b.SubjectName,b.UserID,b.Password,c.RegId,c.Form,c.Term,c.AcademicYear from ProgramDetails.Programs a, ProgramDetails.Subjects b,StudentDetails.Registration c where b.SubjectName='" & Module1.sname & "'and b.UserID='" & txtUserName.Text & "' and b.Password='" & Trim(txtPassword.Text) & "' and c.Term=" & cboTerm.SelectedItem & " and c.academicYear='" & Trim(cboAcadYear.SelectedItem) & "' and c.form=" & cboForm.SelectedItem & " and a.form=c.form and (c.core1='" & Module1.sname & "' or c.core2='" & Module1.sname & "' or c.core3='" & Module1.sname & "' or c.core4='" & Module1.sname & "' or c.core5='" & Module1.sname & "' or c.core6='" & Module1.sname & "' or c.elec1='" & Module1.sname & "' or c.elec2='" & Module1.sname & "' or c.elec3='" & Module1.sname & "' or c.elec4='" & Module1.sname & "')", cn)
dr1 = cmd.ExecuteReader
ctr = ctr + 1
If dr1.Read Then
frm.Show()
ctr = 0
Me.Close()
ElseIf ctr < 3 Then
MessageBox.Show("The selected Subject Name, User Name and Password combination you entered does not match. Please try again.", "Log in Failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Else
MsgBox("Unathorized access. Aborting...")
Close()
End If
dr1.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Akaglo
28-Jan-13 15:42pm
View
I've done exactly that but I couldn't log on to the form with any subject.
Akaglo
28-Jan-13 15:32pm
View
I've copied your code and used it as such, but it's only the subjectcodes of subject names without white space that are being read. Is it because I have the following at Form_load: subj = Module1.sname
subj1 = subj.Replace(" ", "")
subname = subj1
And without the above code I wouldn't be able to log on with subject names with white space. Pls what shall I do again?
Akaglo
28-Jan-13 15:20pm
View
Dim sql = "Select subjectCode From ProgramDetails.subjects where subjectname like @subname"
Using con = New SqlConnection("Data Source=EBENEZERAKAGLO\SQLEXPRESS;Initial Catalog=Naass;Integrated Security=True")
Using cmd = New SqlCommand(sql, con)
cmd.Parameters.AddWithValue("@subname", String.Format("%{0}%", "" & subname & ""))
con.Open()
Using rd = cmd.ExecuteReader()
While rd.Read()
Dim subjectCode = rd.GetInt32(0)
subcode = subjectCode
' ... '
MsgBox(subjectCode)
End While
End Using
End Using
End Using
Akaglo
28-Jan-13 15:08pm
View
Thank you. The variable name that contains the search value is " & subname & " and when I replace "" with this variable name, subjectcodes of subject names that contain white spaces are not read by the SQLDataReader. Pls help me out because I'm so much worried about this problem.
Show More