rhepsi
111 New Member
hii all,
for selecting one item in a combo box n writing a search button_click code for that....
There are 3 items in teh combobox, nw for 1 item i want to write a code for search_button click
How to start with
If combobox = Project Manager Then........... .....>> error
wat shd i consider...
plz someone help...
thnx
Jul 5 '07
Subscribe Reply
14 2459
- <
- 1
- 2
rhepsi 111 New Member
You want to list the projectcode and projectlocation for the projectmanager you selected in the Combobox2.Is this right?If yes,give your table_staff,tab le_staff_assign ment,table_proj ect structures(fiel ds present in the table)
sample query:
select C.ID,C.ProjectC ode,C.ProjectLo cation,C.Projec tName from tbl_staff A
left join tbl_staff _assignments B on B.StaffID=A.ID
left join tbl_projects C on C.ID=B.projectI D
where A.Name=(combobo x.selecteditem)
thnq so much... i shall try tht code... n give u reply...
Jul 6 '07 #11
reply
rhepsi 111 New Member
You want to list the projectcode and projectlocation for the projectmanager you selected in the Combobox2.Is this right?If yes,give your table_staff,tab le_staff_assign ment,table_proj ect structures(fiel ds present in the table)
sample query:
select C.ID,C.ProjectC ode,C.ProjectLo cation,C.Projec tName from tbl_staff A
left join tbl_staff _assignments B on B.StaffID=A.ID
left join tbl_projects C on C.ID=B.projectI D
where A.Name=(combobo x.selecteditem)
Hey ive tried it.... but of no use...
here is my code:
Expand|Select|Wrap|Line Numbers
- 'GetPrimaryKeyfromListbox
- objListItem=CType(cbPrSearchList.SelectedItem,ListItem)
- cmSQL=NewMySqlCommand
- DimmySelectQueryAsString="Selectpr_project_id_pk,pr_project_code,"_
- &"pr_project_location,pr_project_manager_id_fk,pr_street_address,"_
- &"pr_state_id_fk,pr_pincode,pr_postal_address,pr_phone,"_
- &"pr_courier_service,pr_email,pr_om_field,pr_total_students,pr_total_staff,"_
- &"pr_teaching_staff,pr_non_teaching_staff,pr_project_background,"_
- &"pr_profile_status,pr_photo_status,pr_upload_status,pr_comm_history"_
- &"fromtbl_staffsINNERJOINtbl_staff_assignmentsONtbl_staff_assignments.sta_staff_id_fk=tbl_staffs.stf_staff_id_pk"_
- &"INNERJOINtbl_projectsONtbl_projects.pr_project_id_pk=tbl_staff_assignments.sta_project_id_fk"_
- &"WHEREtbl_staff_assignments.sta_project_id_fk=?StId"
- cmSQL.Parameters.Add("?StId",objListItem.ID)
- cnSQL=NewMySqlConnection
- cnSQL.ConnectionString=connect.ConnectionString
- cmSQL.Connection=cnSQL
- cmSQL.CommandText=mySelectQuery
Its takingdirectly the project_id from tbl_projects not from tbl_staff_assig nments project_id...
plz if u can help me...
Jul 9 '07 #12
reply
rhepsi 111 New Member
Hey ive tried it.... but of no use...
here is my code:
Its takingdirectly the project_id from tbl_projects not from tbl_staff_assig nments project_id...Expand|Select|Wrap|Line Numbers
- 'GetPrimaryKeyfromListbox
- objListItem=CType(cbPrSearchList.SelectedItem,ListItem)
- cmSQL=NewMySqlCommand
- DimmySelectQueryAsString="Selectpr_project_id_pk,pr_project_code,"_
- &"pr_project_location,pr_project_manager_id_fk,pr_street_address,"_
- &"pr_state_id_fk,pr_pincode,pr_postal_address,pr_phone,"_
- &"pr_courier_service,pr_email,pr_om_field,pr_total_students,pr_total_staff,"_
- &"pr_teaching_staff,pr_non_teaching_staff,pr_project_background,"_
- &"pr_profile_status,pr_photo_status,pr_upload_status,pr_comm_history"_
- &"fromtbl_staffsINNERJOINtbl_staff_assignmentsONtbl_staff_assignments.sta_staff_id_fk=tbl_staffs.stf_staff_id_pk"_
- &"INNERJOINtbl_projectsONtbl_projects.pr_project_id_pk=tbl_staff_assignments.sta_project_id_fk"_
- &"WHEREtbl_staff_assignments.sta_project_id_fk=?StId"
- cmSQL.Parameters.Add("?StId",objListItem.ID)
- cnSQL=NewMySqlConnection
- cnSQL.ConnectionString=connect.ConnectionString
- cmSQL.Connection=cnSQL
- cmSQL.CommandText=mySelectQuery
plz if u can help me...
Im getting this error
Dim mySelectQuery As String = "Select pr_project_id_p k, pr_project_code ," _
& "pr_project_loc ation, pr_project_mana ger_id_fk, pr_street_addre ss, " _
& "pr_state_id_fk , pr_pincode, pr_postal_addre ss, pr_phone, " _
& "pr_courier_ser vice, pr_email, pr_om_field, pr_total_studen ts, pr_total_staff, " _
& "pr_teaching_st aff, pr_non_teaching _staff, pr_project_back ground, " _
& "pr_profile_sta tus, pr_photo_status , pr_upload_statu s, pr_comm_history , " _
& "pr_cs_comments , pr_lkg, pr_ukg, pr_class01, pr_class02, pr_class03, " _
& "pr_class04 , pr_class05, pr_class06, pr_class07, pr_class08, pr_class09, " _
& "pr_class10 , pr_year_started , pr_land_status, pr_building_sta tus, " _
& "pr_ann_op_cost , pr_project_rema rks, pr_info_date, pr_isactive " _
& "FROM tbl_staffs LEFT JOIN tbl_staff_assig nments ON tbl_staff_assig nments.sta_staf f_id_fk = tbl_staffs.stf_ staff_id_pk " _
& "LEFT JOIN tbl_projects ON tbl_projects.pr _project_id_pk = tbl_staff_assig nments.sta_proj ect_id_fk " _
& "WHERE tbl_staffs.stf_ first_name = ?SID "
cmSQL.Parameter s.Add("?SID", objListItem.ID)
General Error
Cast from string "" to type 'Double' is not valid.
Jul 9 '07 #13
reply
Vidhura 99 New Member
Im getting this errorDim mySelectQuery As String = "Select pr_project_id_p k, pr_project_code ," _
& "pr_project_loc ation, pr_project_mana ger_id_fk, pr_street_addre ss, " _
& "pr_state_id_fk , pr_pincode, pr_postal_addre ss, pr_phone, " _
& "pr_courier_ser vice, pr_email, pr_om_field, pr_total_studen ts, pr_total_staff, " _
& "pr_teaching_st aff, pr_non_teaching _staff, pr_project_back ground, " _
& "pr_profile_sta tus, pr_photo_status , pr_upload_statu s, pr_comm_history , " _
& "pr_cs_comments , pr_lkg, pr_ukg, pr_class01, pr_class02, pr_class03, " _
& "pr_class04 , pr_class05, pr_class06, pr_class07, pr_class08, pr_class09, " _
& "pr_class10 , pr_year_started , pr_land_status, pr_building_sta tus, " _
& "pr_ann_op_cost , pr_project_rema rks, pr_info_date, pr_isactive " _
& "FROM tbl_staffs LEFT JOIN tbl_staff_assig nments ON tbl_staff_assig nments.sta_staf f_id_fk = tbl_staffs.stf_ staff_id_pk " _
& "LEFT JOIN tbl_projects ON tbl_projects.pr _project_id_pk = tbl_staff_assig nments.sta_proj ect_id_fk " _
& "WHERE tbl_staffs.stf_ first_name = ?SID "cmSQL.Parameter s.Add("?SID", objListItem.ID)
General Error
Cast from string "" to type 'Double' is not valid.
& "WHERE tbl_staffs.stf_ first_name = ?SID "
cmSQL.Parameter s.Add("?SID", objListItem.ID)
what the objectlistItem. ID contains?either staffname or ID
If you connecting with ID
use
& "WHERE tbl_staffs.ID= ?SID "
Jul 9 '07 #14
reply
rhepsi 111 New Member
& "WHERE tbl_staffs.stf_ first_name = ?SID "cmSQL.Parameter s.Add("?SID", objListItem.ID)
what the objectlistItem. ID contains?either staffname or ID
If you connecting with ID
use
& "WHERE tbl_staffs.ID= ?SID "
hey thnq so much... its workin nw...
Jul 9 '07 #15
reply
- <
- 1
- 2
Sign in to post your reply or Sign up for a free account.
Similar topics
1 3462 Subform won't show data selected from Combo Box by: Donna Sabol |last post by: I have a form (frm_MAIN_RPT) that contains a combo box (Combo6) & subform (dbo_REQ_subform). The combo box is used to select the "cost center" data that will be displayed in the subform. From there, I have a button that runs a report based on which item I select in the subform. 1. The Combo Box correctly displays the list of cost centers within the combo box. 2. The subform, when opened separately, correctly displays the data for the... Microsoft Access / VBA |
1 2031 How to test if an item has been selected of a combo box by: ree |last post by: I have two combo boxes on a dialog window. The aim is to check the the strings of the items. But if no items are selected then this line crashes the program. if (comboBox1.SelectedItem.ToString() == comboBox2.SelectedItem.ToString()) -- Is there a way to test if an item has been selected. So then i can run the C# / C Sharp |
2 5802 HtmlSelect populated dynamically, fails to return selected item by: Stephen Miller |last post by: When I dynamically populate a HtmlSelect combo box, the Value property consistently fails to return the item selected, defaulting instead to the first item in the list. For example: Protected WithEvents Fruits As System.Web.UI.HtmlControls.HtmlSelect Protected WithEvents Results As System.Web.UI.WebControls.Label Protected WithEvents Button1 As System.Web.UI.WebControls.Button Private Sub Page_Load(ByVal sender As System.Object, ByVal... ASP.NET |
1 2356 Working Code of Bound dropdownlist in Datagrid by: jimb |last post by: I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of Visual Basic .NET |
2 2382 Simple combobox question on text and selected value by: Brian Henry |last post by: say I have a databound combo box, which allows for text entry still (DropDownStype = DropDown in this case). now, If the user doesn't enter manually an item in the data bound list, nothing should be selected of course, but I want if a user enters an item that is in the list already, to select it, and only if the item is a complete match to what they typed to be selected. This is kind of like an auto complete scenerio, but allows for... Visual Basic .NET |
6 5181 setting selected item of a combo box filled with objects by: Smokey Grindle |last post by: Say I have a combo box with the following simple object Public class MyObject public ID as integer public Name as string public overrides sub ToString() as string return name end sub end Class Visual Basic .NET |
16 2977
Display the selected item by: Ranjan kumar Barik |last post by: Hello !!! I am Ranjan. can the selected item of a combo box be displayed on the same page. I mean when I just click the item of a combo box it will atonce displayed on the page. Thanks !!! ASP / Active Server Pages |
14 1756 What's the VB9 equivalent for this code by: Just_a_fan |last post by: In VB6, I could easily take the value from a combo box and make a command with it, this: baudrate = cboBaud(listindex). With the new dotted stuff in VB9, I can't seem to do that. Here's an example of my problem. I have a combo box with various baud rates in it. The user selects one and I want to use it. However, the command to use it is in the format: Visual Basic .NET |
8 1648 making a combo box display a value from its list via code? by: ZaphodBBB |last post by: Hi I have a form frmAdd_Equipment. It has a number of combo boxes on it, cboModel, cboSupplier, cboManufacturer, cboEquipment_Type etc. Bcause therer is no existing data to go off I put an ADD NEW cmdButton next to each of the ComboBoxes so if the item does not exist then the user can add a new Model, Supplier etc. The various ComboBoxes all load from Queries when the Form Loads. What I'd like to do, is to make it so that should the... Microsoft Access / VBA |
7993
What is ONU? by: marktang |last post by: ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of... General |
7920 Changing the language in Windows 10 by: Hystou |last post by: Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,... Windows Server |
1 8054 The easy way to turn off automatic updates for Windows 10/11 by: Hystou |last post by: Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,... Windows Server |
8268
Discussion: How does Zigbee compare with other wireless protocols in smart home applications? by: tracyyun |last post by: Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some... General |
1 5867
Access Europe - Using VBA to create a class based on a table - Wed 1 May by: isladogs |last post by: The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will... Microsoft Access / VBA |
3944 Windows Forms - .Net 8.0 by: adsilva |last post by: A Windows Forms form does not have the event Unload, like VB6. What one acts like? Visual Basic .NET |
1 2418 transfer the data from one system to another through ip address by: 6302768590 |last post by: Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system C# / C Sharp |
1 1510
How to add payments to a PHP MySQL app. by: muto222 |last post by: How can i add a mobile payment intergratation into php mysql website. PHP |
1254
Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy by: bsmnconsultancy |last post by: In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive... General |