|
Hello
Please help me with the select statement for this.After the user select a projectname from the dropdowm.I want the listbox to display the name of all the member that were working under that project.
oga m
|
|
|
|
|
withou knowing the structure of your table I am writing the SQL....
SELECT member_name FROM TableName WHERE projectname='" & mycombo.Text & "'
if this is not the case please let us know your table structure...
Tirtha
"A man can ride on your back only when it is bent....."
|
|
|
|
|
you need to make master + detail
Well your problem needs more explination.
If your data is in a single table then, first you need to bind dropdownlist with the required field you can use
follwoing code or write your on code to fill the drop down list
public void BindDropDownListWithQuery(string sql, DropDownList ddl)
{
try
{
mysqlCommand = new MySqlCommand(sql);
dbConnect();
mysqlCommand.Connection = connection;
mysqlAdapter = new MySqlDataAdapter(mysqlCommand);
dataset = new DataSet();
mysqlAdapter.Fill(dataset, "Table");
ddl.DataSource = dataset.Tables[0];
ddl.DataTextField = dataset.Tables[0].Columns[0].ColumnName.ToString();
ddl.DataValueField = dataset.Tables[0].Columns[1].ColumnName.ToString();
ddl.DataBind();
}
catch (Exception)
{
connection.Close();
connection.Dispose();
}
finally
{
connection.Close();
connection.Dispose();
}
}
then you need to show Details for which you can use data grid
Now its really depend if you are filling datagrid on load event with all records then you need to filter datagrid on the basiss of value selected from dropdownlist
you can do that using this code
if (this.RadioButtonList1.SelectedIndex == 0)
{
this.odsImages.FilterExpression = "fieldname=" + this.DropDownList1.SelectedValue;
}
else if (this.RadioButtonList1.SelectedIndex == 1)
{
this.odsImages.FilterExpression = "field name=" + this.DropDownList1.SelectedValue;
}
if you are not filling datagrid onload event of web form then
you need to fill data grid with select query and you can do this using follwoing code
public void BindDataGrid(string sql, GridView GV)
{
dbConnect();
try
{
mysqlCommand = new MySqlCommand(sql);
mysqlCommand.Connection = connection;
mysqlAdapter = new MySqlDataAdapter(mysqlCommand);
dataset = new DataSet();
mysqlAdapter.Fill(dataset, "Table");
GV.DataSource = dataset;
GV.DataBind();
}
catch (Exception)
{
}
finally
{
connection.Close();
connection.Dispose();
}
}
sql="select * from tbl where fieldname=" + dropdownlist.selectedvalue;
|
|
|
|
|
Naveed Kamboh wrote: sql="select * from tbl where fieldname=" + dropdownlist.selectedvalue;
Rather lengthy response to answer the question asked.
Also, your 'solution' is far to complex for such a simple thing. Where was it mentioned in the OP that he was using a DataGrid and Radio buttons? I only see a dropdown and listbox mentioned.
only two letters away from being an asset
|
|
|
|
|
|
Hello
I am a beginner in programming(asp.net-vb)In my application I need to use an Ajax control(Calender)same as that one in ajax.asp.net/toolkit.When I created my application,I choose website.Now I have incorporated ajax in my current ,so what step should I take?
I need to design the calender,when the user clicks the calendar icon,the calender opens,allow the user to choose the date from the calendar(not only the current date,also previous dates) and the date to be entered in the Date Textbox,after the calender to be closed....
How can I do that cause I've got AjaxToolKit in my ToolBox
oga m
|
|
|
|
|
You can also do it with calender control of asp.net 2.0
don't know abt Ajax
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
please help me with the code.After the user selected the date from the caledar,the week number for the whole year of that date to be displayed in the week number Textbox.
Thank you in advance
oga m
|
|
|
|
|
|
hi
i am posting my question for the first time. it will be a great help if anyone can answer this.
i have an asp.net application in framework 2.0 and i am allowing my users to upload an excel file which contains a table that i need to store in oracle database. i read about sql loader that convert data in any other format. can i use sql loader with my application or if there is any other way in which it can be done,pls do let me know. i am using oracle10g enterprise edition as backend and coding with C# in asp.net. if u can send me the code that will be great.
with thanks
chitra
|
|
|
|
|
Check out this link, it might help you:
http://www.csee.umbc.edu/help/oracle8/server.815/a67792/ch03.htm
Gautham
|
|
|
|
|
thanks gautam
that article was really good.
but i need some code to use sql loader in asp.net to add data in excel file into oracle table.it will be great help if u can send me some code.
regards
chitra
|
|
|
|
|
Personally i have not implemented but would get back to you once i have the sample code ready!
Gautham
|
|
|
|
|
thanks for taking interest in my problem. i am having hard times because of this.
chitra
|
|
|
|
|
Have you found a solution!
Gautham
|
|
|
|
|
i've tried something. it is working with sql server but it doesn't seem to be working with oracle.I am receiving an error.Here's the coding to save the file on the disk.
HttpPostedFile filupload = FileUpload1.PostedFile;<br />
int filelength = System.Convert.ToInt32(filupload.ContentLength);<br />
byte[] data = new byte[filelength];<br />
string name = FileUpload1.FileName.Remove(3);<br />
filupload.InputStream.Read(data, 0, filelength);<br />
string username = this.Session["username"].ToString();<br />
string filename="C:\\Inetpub\\wwwroot\\website1\\data\\"+username+".xls";<br />
filupload.SaveAs(filename);<br />
and this is the code that i used to send excel file to sql database:
string conn = @" Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Inetpub\wwwroot\website1\data\"+ sheetname+";Extended Properties=Excel 8.0;Persist Security Info=false";<br />
string sqlconn = "Data Source=CHITRA;Initial Catalog=northwind;Integrated Security=True";<br />
OleDbConnection xlcon = new OleDbConnection(conn);<br />
string strComand = "select * from [sheet1$A1:C3]";<br />
OleDbDataAdapter xlda = new OleDbDataAdapter(strComand, xlcon);<br />
DataTable xldt = new DataTable();<br />
DataSet xlds = new DataSet();<br />
<br />
xlda.Fill(xldt);<br />
xlda.Dispose();<br />
SqlConnection sqlcon = new SqlConnection(sqlconn);<br />
SqlDataAdapter sqlda = new SqlDataAdapter("select * from products", sqlcon);<br />
<br />
DataSet ds = new DataSet();<br />
sqlcon.Open();<br />
sqlda.Fill(ds, "products");<br />
<br />
foreach (DataRow xlrow in xldt.Rows)<br />
{<br />
DataRow ordr = ds.Tables["products"].NewRow();<br />
string productid, productname, unitprice;<br />
ordr["productid"] = xlrow[0];<br />
ordr["productname"] = xlrow[1];<br />
ordr["unitprice"] = xlrow[2];<br />
ds.Tables["products"].Rows.Add(ordr);<br />
sqlda.Update(ds, "products");<br />
}<br />
<br />
ds.AcceptChanges();<br />
sqlda.Dispose();
if u find the data adapter is not working then use the insert query.but when i am trying it with oracle it is giving me this error and i couldn't find any description for this error. here it goes;
Unable to load DLL 'OraOps10.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
can any one help.
|
|
|
|
|
Please don't repost.
Best Regards,
Apurva Kaushal
|
|
|
|
|
I have page1.aspx which includes in the code behind the lines:
String commandstringclose = "chatbotwindow.close();";
ButtonCloseChatbot.Attributes.Add("onclick", commandstringclose);
The window.open() script gets called earlier in the page, so this works fine to close the window when the ButtonCloseChatbot is clicked.
My questions is, can I call the same method from another page? i.e. When the user is on another page of the site (logout.aspx) I want to be able to do chatbotwindow.close(). How do I pretend that ButtonCloseChatbot was clicked in the logout.aspx code? Or, is there a way to use the window.close() function from a page which is not the page that called the open() function?
Thanks,
Alice
|
|
|
|
|
Dear Friends i want to provide an option of printing a document on my web site but i have no idea about this please Help me with sample code... i am using ASP.NET 2005 ,VB.NET 2005 please reply me as soon as possilble.....
Ahmed
|
|
|
|
|
You can use javascript window.print function for this purpose.
Best Regards,
Apurva Kaushal
|
|
|
|
|
thanx for reply dear can you send me some code example please............
|
|
|
|
|
Suppose for a button if you want to print the page then you can do it like this:
button1.attributes.add("onclick", "javascript window.print();");
Best Regards,
Apurva Kaushal
|
|
|
|
|
on the button click event enter this code..
Button1.Attributes.Add("onClick", "window.print();");
else. u can create an HTML input button and write
<form><input type="button" value=" Print this page "<br />
onclick="window.print();return false;" /></form>
u can create a link as well... same way..
Kunal
|
|
|
|
|
Hi
I have a Datagrid and Button controls in a webform I am displaying Dept Details in Webform1.But when I click Button
Then Entire Details should display in webform2 using sessions How?
Thanks
|
|
|
|
|
You can store the complete data in session and then you can bind your controls after getting the data from session in the second page.
Best Regards,
Apurva Kaushal
|
|
|
|