|
but i have many walu in child hash table like this:-
Dim ConfId As String
Dim meesage As String
Dim SinglNode As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference")
ConfId = SinglNode.Attributes("confId").InnerText
Dim SinglNode1 As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference/messageReceived/message/content")
If SinglNode1.InnerText <> "" Then
meesage = SinglNode1.InnerText
'M_MessageTextHTAble = M_MessageHTAble.Item(ConfId)
M_Messagecounter = M_Messagecounter + 1
M_MessageTextHTAble.Add(M_Messagecounter, meesage)
M_MessageHTAble.Remove(ConfId)
M_MessageHTAble.Add(ConfId, M_MessageTextHTAble)
End If
Return M_MessageHTAble
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
Step 1 :
Get the Fist M_MessageTextHTAble from the M_MessageHTAble by ConfId
Step 2 :
Get the all item from M_MessageTextHTAble by For each statement
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
This code works for you. You can add different items in child node.
These item can be of any type.
All you need is type casting.
Lets suppose you added SinglNode of XMLNode type in child hash table.
You shall use this line for getting that object
((XMLNode)((Hashtable)mainHashTable["HashTable"])["ChildValue"]))
This line first get the value of child table then convert it to XMLNode.
You can add multiple different objects in hash table.
//Make main Hash table
Hashtable mainHashTable = new Hashtable();
//Make child Hash Table
Hashtable childHashTable = new Hashtable();
//Add child hash table value
childHashTable.Add("ChildValue", "Mubashir");
//Add child hash table to main hash table
mainHashTable.Add("HashTable", childHashTable);
//Get Child Hash table value
((Hashtable)mainHashTable["HashTable"])["ChildValue"].ToString()
|
|
|
|
|
This helpful to extract the whole list of key & values when debugging:
Public Shadows Function ToString(ByVal hashTable As Hashtable) As String
Dim s As String = String.Empty
Dim enumerator As IDictionaryEnumerator = hashTable.GetEnumerator()
While (enumerator.MoveNext())
s += enumerator.Key & ": " & enumerator.Value & ControlChars.NewLine
End While
Return s
End Function
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Response.Write("alert('"+ID.ToString()+"')");
I am writig the code in VB for a asp application but the statement is giving an error at the last semicolon " character is not valid"
Pl help
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Prakash_Mishra wrote: Response.Write("alert('"+ID.ToString()+"')");
In VB semicolon is not required.
Instead you need to place the semicolon after your alert statement.
Apurva Kaushal
|
|
|
|
|
I wrote the code like this
Dim con3 As New SqlConnection
con3.ConnectionString = "workstation id=R21;packet size=4096;integrated security=SSPI;data source=R21;persist security info=False;initial catalog=Test"
Dim ID As String = "select Cand_Id from Feedback where Cand_Id in(select Max(Cand_Id) from Feedback )"
con3.Open()
Dim cmd3 As New SqlCommand
cmd3.CommandText = ID
cmd3.Connection = con3
cmd3.ExecuteNonQuery()
con3.Close()
Response.Write("alert('" + ID.ToString() + "')")
But in the alert box its showing the output as the entire query not thr id
OUT PUT = select Cand_Id from Feedback where Cand_Id in(select Max(Cand_Id) from Feedback )
But i want my out put to be 1 , 2 .... like this
PL help
Prakash Mishra(Banglore,India)
|
|
|
|
|
This is happening because the text what you have stored in string ID is the same what you are getting. What you need to do is to store the data (what sqlquery is returning) in dataset and then use dataset to display the data.
Apurva Kaushal
|
|
|
|
|
This is the code i wrote in which i used the dataset but how to assign the value of dataset into the ID variabe iam not geeting, If possible pl modify the code and send me its having error and I am not getting what to do Pl help me Apurva
Dim con3 As New SqlConnection
Dim cmd3 As New SqlCommand
con3.ConnectionString = "workstation id=R21;packet size=4096;integrated security=SSPI;data source=R21;persist security info=False;initial catalog=Test"
con3.Open()
Dim ds3 As New DataSet
Dim queryString3 As String = "select Cand_Id from Feedback where Cand_Id in(select Max(Cand_Id) from Feedback )"
cmd3.CommandText = queryString
cmd3.Connection = con
Dim sqlda As New SqlDataAdapter(queryString3, con3)
sqlda.Fill(ds3)
ID = ds3
Response.Write("alert('" + ID.ToString() + "')")
con3.Close()
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Prakash_Mishra wrote: ID = ds3
Inspite of that take it as this:
ID = ds3.Tables[0].Rows[0]["Cand_Id"].ToString();
Apurva Kaushal
|
|
|
|
|
If i am writing that line i am getting the following error
value of type 'SystemData.DataTableCollection' can not be converted to string
Prakash Mishra(Banglore,India)
|
|
|
|
|
What exactly is the line which you have used?
Apurva Kaushal
|
|
|
|
|
ID = ds3.Tables[0].Rows[0]["Cand_Id"].ToString()
Prakash Mishra(Banglore,India)
|
|
|
|
|
Is ID is of string type?
put like this:
string ID = ds3.Tables[0].Rows[0]["Cand_Id"].ToString()
Apurva Kaushal
|
|
|
|
|
Thanks Apurva for being so patient. Yes its of type string
In the statement ds3.Tables[0].Rows[0]["Cand_Id"].ToString(). Its asking for identifier expected in statement
ds3.Tables[0]
below[0]. Is is a synatx prob i am using VB
Prakash Mishra(Banglore,India)
|
|
|
|
|
In vb.net it will be like this:
ID = ds.Tables(0).Rows(0)("ID").ToString()
Apurva Kaushal
|
|
|
|
|
THANKS APURVA
I TRIED WITH ROUND BRACKET AND IT WORKED. THANKS FOR BEING SO NICE TO ME. THANKS A LOT.
REGARDS
Prakash Mishra(Banglore,India)
|
|
|
|
|
Always welcome..
Apurva Kaushal
|
|
|
|
|
Hai friends..
I am new to asp.net.I would like to know how to Redirect from one URL to another URL.My problem is that i upload my project in server.suppose, www.firstproject.com is the website name ,in that project there is link to go to www.secondproject.com.....(these two works are uploaded in 2 different server).But it is not working with my code....How to do that????any idea please help me....am using .NET 1.1 version and c# coding......
Thanks in advance
|
|
|
|
|
Response.Redirect() will serve the purpose for you.
Apurva Kaushal
|
|
|
|
|
Thanks for your reply.
But Actually my problem is different ,i dont want to redirect from one page to another page in the same project.Instead of that ,i want to redirect from one website to another site...for example www.yahoo.com to www.rediffmail.com
|
|
|
|
|
That will work fine with that also. You can redirect to another site also.
Apurva Kaushal
|
|
|
|
|
Thanku very much for your confident reply
I try Response.redirect withot using http in first time
But after your reply i try with http (ie,Response.redirect("http://www.xyz.com");
now my case is working fine.
Thanks once again
|
|
|
|
|
Always welcome..
Apurva Kaushal
|
|
|
|
|
Use, Response.Redirect("testpage.aspx");
will help you.
where the testpage is the page where you want to redirect page.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|