Click here to Skip to main content
15,896,153 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Handle master page button(s) click events on content page Pin
De_Novice23-Mar-11 6:19
De_Novice23-Mar-11 6:19 
QuestionMaskedEdit extender and special characters Pin
Peterson Luiz23-Mar-11 5:03
Peterson Luiz23-Mar-11 5:03 
QuestionPaste data from excel Pin
Hum Dum22-Mar-11 23:00
Hum Dum22-Mar-11 23:00 
AnswerRe: Paste data from excel Pin
Dalek Dave23-Mar-11 5:03
professionalDalek Dave23-Mar-11 5:03 
AnswerRe: Paste data from excel Pin
Pavel Yermalovich23-Mar-11 22:47
Pavel Yermalovich23-Mar-11 22:47 
QuestionHow to save data and retrieve data from database using two tables in gridview? Pin
snamyna22-Mar-11 21:55
snamyna22-Mar-11 21:55 
AnswerRe: How to save data and retrieve data from database using two tables in gridview? Pin
ktrrzn5-Apr-11 19:32
ktrrzn5-Apr-11 19:32 
GeneralRe: How to save data and retrieve data from database using two tables in gridview? Pin
snamyna6-Apr-11 14:35
snamyna6-Apr-11 14:35 
Hye ktrrzn..
Thanks for your reply but i have come out with the solution earlier where I just retrieve the data to insert to the gridview by using SqlDataSource, but for saving the other column in the gridview into the database, I am using Sql query in .vb file instead of SqlDataSource. Smile | :)

Now I got another problem where I want to display all data that has same max values. Do u have any idea where should I rewrite so that I can display all the data? I have debugging this code but there's no error. After running it, all the data came out was the same.
This is the overview of my data.

Career - Marks

Medical - 12
Sport Science - 12
Dietetic - 12
Optometry - 12
Physiology - 12
Medical Laboratory Technology - 12
Biomedical - 12
Audiology - 12
Forensic - 12
Veterinary - 12

The result that came out after running my code is :
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12
Veterinary - 12

So how to display all different careers with the same marks?
This is my vb code.

Dim connString As String = "Data Source=AINA-PC;Initial Catalog=LaluanKerjaya;Integrated Security=True"
Dim con As SqlConnection = New SqlConnection(connString)
Dim kp As String = CType(Session.Item("KP"), String)

Dim noic As String = CType(Session.Item("NOIC"), String)
KPLabel.Text = noic

Dim cmdQuery As String = "SELECT count(Career) FROM Analysis WHERE Jumlah = (SELECT MAX(Marks) FROM Analysis ) AND UserID = '" + kp + "'"
Dim cmd As SqlCommand = New SqlCommand(cmdQuery, con)
Dim dr As SqlDataReader

Dim labelCount As Integer
Dim career As String

con.Open()

dr = cmd.ExecuteReader()
While dr.Read()

labelCount = dr.GetValue(0)

End While
dr.Close()
For i As Integer = 0 To labelCount - 1
' Create the label control and set its text attribute
Dim Label1 As New Label

Dim cmdQuery2 As String = "SELECT Career FROM Analysis WHERE Marks= (SELECT MAX(Marks) FROM Analysis ) AND UserID = '" + kp + "'"

Dim cmd2 As SqlCommand = New SqlCommand(cmdQuery2, con)
Dim dr2 As SqlDataReader = cmd2.ExecuteReader()

'con.Open()


While dr2.Read()

career= dr2("Career").ToString()
'Session("CAREER") = career


End While
dr2.Close()

Label1.Text = career
cmd2.ExecuteNonQuery()
cmd2.Parameters.Clear()
'con.Close()

Dim Literal1 As New Literal
Literal1.Text = "<br />"

' Add the control to the placeholder
PlaceHolder1.Controls.Add(Label1)
PlaceHolder1.Controls.Add(Literal1)

Next

cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
con.Close()
AnswerRe: How to save data and retrieve data from database using two tables in gridview? Pin
ktrrzn6-Apr-11 15:12
ktrrzn6-Apr-11 15:12 
GeneralRe: How to save data and retrieve data from database using two tables in gridview? Pin
snamyna6-Apr-11 19:13
snamyna6-Apr-11 19:13 
QuestionHow to Convert ASP.NET web application to ASP.NET Web Service Application Pin
VenkataRamana.Gali22-Mar-11 20:51
VenkataRamana.Gali22-Mar-11 20:51 
QuestionAccess content page procedure from master page button Pin
De_Novice22-Mar-11 6:50
De_Novice22-Mar-11 6:50 
AnswerRe: Access content page procedure from master page button [modified] Pin
Not Active22-Mar-11 7:47
mentorNot Active22-Mar-11 7:47 
GeneralRe: Access content page procedure from master page button Pin
De_Novice22-Mar-11 7:55
De_Novice22-Mar-11 7:55 
GeneralRe: Access content page procedure from master page button Pin
Not Active22-Mar-11 8:02
mentorNot Active22-Mar-11 8:02 
GeneralRe: Access content page procedure from master page button Pin
De_Novice22-Mar-11 8:08
De_Novice22-Mar-11 8:08 
GeneralRe: Access content page procedure from master page button Pin
Not Active22-Mar-11 8:28
mentorNot Active22-Mar-11 8:28 
GeneralOff Topic Pin
Rajesh R Subramanian23-Mar-11 22:06
professionalRajesh R Subramanian23-Mar-11 22:06 
QuestionGive me Suggestions to maintain security for websites Pin
Rajeshwar Code- Developer22-Mar-11 2:27
Rajeshwar Code- Developer22-Mar-11 2:27 
AnswerRe: Give me Suggestions to maintain security for websites Pin
Richard MacCutchan22-Mar-11 4:25
mveRichard MacCutchan22-Mar-11 4:25 
AnswerRe: Give me Suggestions to maintain security for websites Pin
thatraja22-Mar-11 4:49
professionalthatraja22-Mar-11 4:49 
AnswerRe: Give me Suggestions to maintain security for websites Pin
Dalek Dave22-Mar-11 5:06
professionalDalek Dave22-Mar-11 5:06 
JokeRe: Give me Suggestions to maintain security for websites Pin
Not Active22-Mar-11 6:15
mentorNot Active22-Mar-11 6:15 
GeneralRe: Give me Suggestions to maintain security for websites Pin
Paladin200022-Mar-11 6:28
Paladin200022-Mar-11 6:28 
GeneralRe: Give me Suggestions to maintain security for websites Pin
Not Active22-Mar-11 6:47
mentorNot Active22-Mar-11 6:47 

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.