|
|
how to use reporting services in sql server 2005
|
|
|
|
|
|
Hi guys,
Actually im developing a web application on VS2003 framework 1.1, in this application i have several textboxes and one dropdown list box. Now the items in my dropdown listbox gets populated from the database table also i have an insert button on clicking it the datas in the textbox and also the selected item in the dropdown list box gets inserted into my database table. Here comes the issue now in my dropdown listbox say there are 2 items for example --> Tiger, Lion... since here tiger is the first element by default my listbox shows tiger may be from the dropdown list if i select lion it inserts only tiger.. in short my listbox doesnt identify my selected item..
The code is as follows:
private void Button1_Click(object sender, System.EventArgs e)
{
try
{
card = DropDownList1.SelectedItem.Text.ToString();
name = TextBox34.Text;
age = TextBox35.Text;
gender = TextBox36.Text;
con = new SqlConnection();
con.ConnectionString = Session["sqlcon"].ToString();
con.Open();
cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Insert into card_details values('"+Session["User_ID"]+"',getDate(),'"+name+"','"+age+"','"+gender+"','"+card+"')";
cmd.Connection = con;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
catch (Exception exp)
{
Label39.Visible = true;
Label39.Text = "Exception occured review log file for details";
ExceptionHandler.HandleException("Exception",exp);
}
finally
{
if (rdr != null)
{
rdr.Close();
}
if (con != null)
{
con.Close();
con.Dispose();
}
}
}
I really dont know whats wrong in my code do plz help me..
Thanks & Regards,
Tash
|
|
|
|
|
<<tash18>> wrote: whats wrong in my code
Plenty.
name = TextBox34.Text;
First of all you are accepting direct, unvalidated input from user controls that can and will expose your application to SQL inject attacks.
con.ConnectionString = Session["sqlcon"].ToString();
Do not store the connection string in a Session variable. Another security hole and unnecessary. You don't even handle the case where it could be null.
card = DropDownList1.SelectedItem.Text.ToString();
When the button is clicked, whatever the currently selected item in the dropdown is what will be used. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: When the button is clicked, whatever the currently selected item in the dropdown is what will be used.
what ever item i select from the list box only the 1st element in the listbox gets inserted... may be if i select 5th item in the list and click the insert button the first element in the list gets inserted... why does that happen.. im confused...
|
|
|
|
|
Is AutoPostBack property set to true? Naina
|
|
|
|
|
Thanx my issue was with postback.. thanx a lot...
|
|
|
|
|
It sounds like you are populating the listbox but not taking PostBack into account.
Wherever it is you are binding the data surround the code with:
if (!PostBack)
{
... code to bind listbox to data.
}
otherwise every time you hit the button the listbox gets repopulated and you will always get the first item in the list as your value.Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
Thanx alot u solved my probs... but let me knw y we use
digital man wrote: if (!PostBack)
{
... code to bind listbox to data.
}
thanx and regards,
Tash
|
|
|
|
|
Simply put, this construct tells the page that it should only do whatever is inside the 'if' should this be the first time the page has been loaded.Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
hii friends,
i have a requirement as following.. in the case of gmail or yahoo mail, if we get any new mail., it will be shown like this Inbox(5), Drafts(2).
but in case of facebook its quite different, it shows a label embedded within an image. On the top left of facebook we find, messages, notifications, etc., all are shown in this format in facebook.
so how can i implement this type of facebook design in my site. And it has to increment the label dynamically when a new mail or message comes.shall we use css or does it need wpf..??
any help would be appreciated. Thank u.
|
|
|
|
|
Have a div.Inside the div,put an image and an label.Update the label and image(if required) when new mail comes.Now how you are going to increment the count,It is upto your design. Cheers!!
Brij
|
|
|
|
|
how to prepare time sheet application for employees using asp.net with c#.net
in the office when ever employee login time should be noted and based on this reports should be generated for weekly wise and monthly wise
can any body help
|
|
|
|
|
No body is here who is going to create design and code your website.You have to do it by yourself.Do some research,make a proper requirement document.Have some analysis on that.make the design,have some POCs the start you application development.. Cheers!!
Brij
|
|
|
|
|
hi,
in my web site (www.bposllc.com) i hope to include meta keywords that are dynamically upload when products links are clicking. i want to know that is it good or bad when crowling search engine
|
|
|
|
|
i am not gettting your meaning of upload metakeyword dynamically but it is beneficial as you generate dynamically as per product.
you can add this into your database and get from thier (individual for each product). it will help to for SEO.Regards
Keyur Satyadev
|
|
|
|
|
My point of view, different meta keywords for different product is good for SEO purpose.
|
|
|
|
|
Hi All,
May i know what is Windows Cardspace? whether we have to include any device for it?
Tried in google but failed to understand.Please let me know the very hight level of it...
thanks in advanceRamkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
Hello Coders,
I have a gridview with paging fascility on a modelpopup control but this paging is not working properly over modelPopup .wn I click over page no. it close the modelpopup n jump over the page itself n when i open the popup control the paging records shown.I Use update panel on main Page.
Any help would be appreciatable.Amit Gautam
|
|
|
|
|
Hi Friends,
I am using a web application which is recently Converted from vs-2003 to vs-2008.Here whenever i build this application, the related dll in bin folder is not updated. what may be the reason? how can i overcome this? I need this recently modified dll to be used in main project.Can you please guide?
Thanks in Advance
Prasad.
|
|
|
|
|
Is the DLL you are using a .NET assembly within the same solution? And if so, did you make the reference to the Project of that assembly? (as in Add Reference >> Projects >> Your DLL project)
|
|
|
|
|
Hi Calla,
thanks for ur reply.
I tried doing Add reference>>Projects, but nothing is available.
I need to know why we have to add reference? bcoz in vs-2003, whenever we build the application
the respective dll gets updated right?
|
|
|
|
|
Well, if the DLL you want to use is a project you build in your solution you have to add a reference to the output of that project in VS so a dependency is created and then the file will be built automatically. If it is a third party DLL then you simply add a reference to the file itself (but from what I understand this is not your case).
When you open up your solution in VS and choose Add Reference to your Project, do you mean that none of the projects in your solution is shown under the Projects tab?
|
|
|
|
|
yes calla..
nothing was shown.
|
|
|
|