|
Sorry im not able to cope with the replies posted here... I mean im not able to implement the logic... Im totally hit with it...
Any advice is appreciated...
Thanx in advance,
Tash
|
|
|
|
|
Yes, that whole logic thing will get you everytime.
Dim connection As New SqlConnection("server=MyServer;Trusted_Connection=true;database=MyDatabase")
connection.Open()
Dim command As New SqlCommand("select MyKey,MyField1,MyField2 from MyTable order by MyKey;", connection)
Dim reader As SqlDataReader = command.ExecuteReader()
Response.Write("<table border='1'>")
'Read the first record
reader.Read()
'Set the control break
Dim ControlBreak As Integer = CInt(reader(0))
'Write all cells
Response.Write("<tr><td>" & reader(0) & "</td><td>" & reader(1) & "</td><td>" & reader(2) & "</td></tr>")
While reader.Read()
If reader(0).Equals(ControlBreak) Then
'Write some cells
Response.Write("<tr><td colspan='2'> </td><td>" & reader(2) & "</td></tr>")
Else
'Reset the control break
ControlBreak = CInt(reader(0))
'Write all cells
Response.Write("<tr><td>" & reader(0) & "</td><td>" & reader(1) & "</td><td>" & reader(2) & "</td></tr>")
End If
End While
Response.Write("</table>")
reader.Close()
connection.Close()
|
|
|
|
|
Thanx for ur reply... but in my code i dont use reader i store it in a dataset.... so working on it.. Any advice is appreciated..
Thanx in advence..
Tash
|
|
|
|
|
Thanx a lot i found another solution for my issue.... actually i used the following code to solve it...
i used String collection to store the value and checked it and printed the table accordingly
ElseIf page = "UserApplication" Then
If DS.Tables(0).Rows.Count > 0 Then
InsertPageBreak()
InsertAppUserHeader()
Dim nfile As StringCollection = New StringCollection
Session("sc1") = nfile
For i = 0 To DS.Tables(0).Rows.Count - 1
PopulateAppUsrRow(DS.Tables(0).Rows(i)(0), DS.Tables(0).Rows(i)(1), DS.Tables(0).Rows(i)(2), DS.Tables(0).Rows(i)(3), DS.Tables(0).Rows(i)(4))
'DataSetToExcel.Convert(DS, Response)
Next
Now the Html table gets populated by the following code:
Public Sub PopulateAppUsrRow(ByVal Usrid As String, ByVal Usrname As String, ByVal Grpid As String, ByVal Grpdsc As String, ByVal FncDsc As String)
If Not Session("sc1").Contains(Usrid) Then
Session("sc1").Add(Usrid)
Response.Write("<tr><td align=left>" + Usrid + "</td><td align=left >" + Usrname + "</td><td align=left >" + Grpid + "</td><td align=left >" + Grpdsc + "</td><td align=left >" + FncDsc + "</td></tr>")
Else
Response.Write("<tr><td align=left> </td><td align=left >" + Usrname + "</td><td align=left >" + Grpid + "</td><td align=left >" + Grpdsc + "</td><td align=left >" + FncDsc + "</td></tr>")
End If
End Sub
Im happy with this kinda output.. any advice is appreciated...
Thanx in advance...
Tash
|
|
|
|
|
hi, iam using asp.net2.0 with c# with sql server
the table fields are as follows
username nvarchar
password nvarchar
emailid nvarchar
usertype int(1=administrator,2=programmer,3=manager,4=user)
active bit
so based on the user types how to give access on each page and on controls like buttons. and for different users different permissions .can you give me example which helps me
|
|
|
|
|
For this, when user login to application ,also retrieve the type of user say administrator etc and save the type of user in session.And on every pageload, you can just check the type of user and accordingly yoy can take decision which buttions/links you need to disabe/hide.
And if user goes direcly to the page which is not for it ,you can show "Access Denied" message.Cheers!!
Brij
|
|
|
|
|
how to give access permission on menu control using asp.net wit c#
give me example which helps me
|
|
|
|
|
|
iam using asp.net2.0 with c# with sql serever i want to store the employees details in the database which includes image of employee also so how to retrieve the image from database and display in image control
please give me suitabe solution which helps me
|
|
|
|
|
You can save the image path in database and store the image in physical location. So, when you are retreiving the from database, retreive the image path and then load the corresponding image from physical path.
You can have a look into this article as a ref.
Displaying Image in Gridview from Database[^]
Let me know if you need any help !Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
oh i dint see your post bro...
|
|
|
|
|
No Problem ! Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
store file name of image in db. and image in some folder in your application.
retrieving to image control..
image.imageurl="physical path where you hav stored images"...
LogoProject.ImageUrl = "~/test/" + id + "_" + img;
|
|
|
|
|
developerit wrote: please give me suitabe solution which helps me
Doesn't work like that: what happens is you try to work it out for yourself using the years of experience and knowledege you already have. Then when you are still stuck you come here and say 'This is what I have already tried: can you help me see where I am going wrong?'
In any case, if you googled you'd probably find a thoudand and one ways to do this.Tychotics
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
|
iam using asp.net2.0 with c#,in my website iam using
requiredfield validators and ajax controls. if iam entered any incorrect values in textboxes then i want to clear the text boxes then i have return the code for clearing the controls in clear button . but when i click clear button then validation controls and ajax validator calloutextenders is displaying and the textboxes are not clearing. how to solve this situations please give me example which helps me
|
|
|
|
|
set the
CausesValidation = "false" property of the clear button.
|
|
|
|
|
thanks it really helps...thanks for codeproject team
|
|
|
|
|
can anyone let me know how to use sql profiler 2005???
|
|
|
|
|
|
Hi, This is ASP.NET Forum. SQL Profiler has nothing to with ASP.NET. Better place to ask Database related question is General Database Forum.
BTW : You can check this, which I wrote few years back
SQL Server Profiler Step by Step[^]
and here is many more,
How to use SQL Server profilerCheers !
Abhijit
Codeproject MVP
|
|
|
|
|
i m sorry...i wanted to post in sql but dint notice i was still in asp.net forum...sorry for the inconvenience...and thanks for providing the links...
|
|
|
|
|
No Problem. Its happened sometimes. Please do it from next time. Let us know if you need any more help. Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
hi i need to make an entry in the session table once the user logs. need to use web service methods for everything. i ve written a stored prov for login and within that i ve called the session procedure. while running web service method i m getting an error "string or binary truncated. statement has been terminated".
as i couldnt spot the error i tried writing a separate method for session in webservice and tried calling it from login method. i m not getting any error but the entry is not made in the session table.
can anyone help me out?
|
|
|
|
|