473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to find whether the particular record is in mysqldatabase ??

111 100+
hii all,

Im doin a vb.net project... where i need to insert only 1 manager for 1 project location..
i already have managers and locations... and category id for the manager is 1.

i have 3 tables: tbl_staff_categories A
tbl_satff_assignments B
tbl_projects C

wherein...>>A.staff_id_pk=B.staff_id_fk =1

plz someone help..
thnx
Jul 9 '07 #1
6 1002
Frinavale
9,735 Expert Mod 8TB
hii all,

Im doin a vb.net project... where i need to insert only 1 manager for 1 project location..
i already have managers and locations... and category id for the manager is 1.

i have 3 tables: tbl_staff_categories A
tbl_satff_assignments B
tbl_projects C

wherein...>>A.staff_id_pk=B.staff_id_fk =1

plz someone help..
thnx
Hi Rhepsi,

What have you tried so far to solve your problem?
Have you seen this .NET article on how to use a database in your program ?

-Frinny
Jul 9 '07 #2
rhepsi
111 100+
Hi Rhepsi,

What have you tried so far to solve your problem?
Have you seen this .NET article on how to use a database in your program ?

-Frinny
thnx for ur reply..

i need to write this query using joins...
...>>>
Dim myselectquery As String = "SELECT pr_project_id_pk FROM tbl_projects WHERE pr_project_location= objListItem"

Dim myselectquerya As String = "SELECT sta_category_id_fk FROM tbl_staff_assignments WHERE sta_project_id_fk=tbl_projects.pr_project_id_pk"

.............>>>

joining these two queries...???
Dim sta_project_id_fk As Integer
If sta_project_id_fk = 1 Then
{
manager is available
}
end if

plz help..
thnx..
hepsi
Jul 10 '07 #3
Frinavale
9,735 Expert Mod 8TB
thnx for ur reply..

i need to write this query using joins...
...>>>
Dim myselectquery As String = "SELECT pr_project_id_pk FROM tbl_projects WHERE pr_project_location= objListItem"

Dim myselectquerya As String = "SELECT sta_category_id_fk FROM tbl_staff_assignments WHERE sta_project_id_fk=tbl_projects.pr_project_id_pk"

.............>>>

joining these two queries...???
Dim sta_project_id_fk As Integer
If sta_project_id_fk = 1 Then
{
manager is available
}
end if

plz help..
thnx..
hepsi
If you're using MS SQL, have you tried using Query analyzer to test your SQL statements before using them in code?

Even if you're not using MS SQL, you should test your SQL commands before using them in your .NET code.

Are you sure this isn't a database question?
Jul 10 '07 #4
rhepsi
111 100+
If you're using MS SQL, have you tried using Query analyzer to test your SQL statements before using them in code?

Even if you're not using MS SQL, you should test your SQL commands before using them in your .NET code.

Are you sure this isn't a database question?

hii, this is not a database question...

Have you any idea abt joining tables and combo box value.. ??
plz help..

thnx
hepsi.
Jul 11 '07 #5
Frinavale
9,735 Expert Mod 8TB
hii, this is not a database question...

Have you any idea abt joining tables and combo box value.. ??
plz help..

thnx
hepsi.
That link on how to use a database gives a basic example of how to retrieve data from your database.

Once you have retrieved the data and have stored it into a DataRead, you will have to loop through all of the records in the DataReader and add them to your combo box (or drop down list).

For example you'll want to do something like:
Expand|Select|Wrap|Line Numbers
  1.   Dim dbCon As SqlConnection
  2.   dbCon = New SqlConnection(connectionString)
  3.   Dim sqlCom As New SqlCommand
  4.   sqlCom.Connection = dbCon
  5.   sqlcom.CommandType = CommandType.Text
  6.  
  7.   sqlCom.CommandText = "Your String Containing Your SQL Select Statement"
  8.  
  9.   'Add any parameters you need in order to execute the SQL statment successfully 
  10.   'eg: sqlCom.Parameters.Add("@cID", SqlDbType.Int).Value = "1234567"
  11.  
  12.       Try
  13.           Dim dr As SqlDataReader
  14.           dbCon.Open()
  15.           dr = sqlcom.ExecuteReader
  16.  
  17.           If dr.HasRows = True Then
  18.               While dr.Read
  19.                    theComboBox.Items.Add(New ListItem(ctype(dr(blabla),String),ctype(dr(blabla),String)))
  20.               End While
  21.           End If
  22.  
  23.           dr.Close()
  24.           dbCon.Close()
  25.  
  26.       Catch ex As Exception
  27.  
  28.       End Try
  29.  
*Please note that the above code will not work. It is just meant to be a guideline

-Frinny
Jul 11 '07 #6
rhepsi
111 100+
That link on how to use a database gives a basic example of how to retrieve data from your database.

Once you have retrieved the data and have stored it into a DataRead, you will have to loop through all of the records in the DataReader and add them to your combo box (or drop down list).

For example you'll want to do something like:
Expand|Select|Wrap|Line Numbers
  1.   Dim dbCon As SqlConnection
  2.   dbCon = New SqlConnection(connectionString)
  3.   Dim sqlCom As New SqlCommand
  4.   sqlCom.Connection = dbCon
  5.   sqlcom.CommandType = CommandType.Text
  6.  
  7.   sqlCom.CommandText = "Your String Containing Your SQL Select Statement"
  8.  
  9.   'Add any parameters you need in order to execute the SQL statment successfully 
  10.   'eg: sqlCom.Parameters.Add("@cID", SqlDbType.Int).Value = "1234567"
  11.  
  12.       Try
  13.           Dim dr As SqlDataReader
  14.           dbCon.Open()
  15.           dr = sqlcom.ExecuteReader
  16.  
  17.           If dr.HasRows = True Then
  18.               While dr.Read
  19.                    theComboBox.Items.Add(New ListItem(ctype(dr(blabla),String),ctype(dr(blabla),String)))
  20.               End While
  21.           End If
  22.  
  23.           dr.Close()
  24.           dbCon.Close()
  25.  
  26.       Catch ex As Exception
  27.  
  28.       End Try
  29.  
*Please note that the above code will not work. It is just meant to be a guideline

-Frinny


thnx... itz been a gr8 help...
Jul 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Adam Hearn | last post by:
Sorry if this difficult to understand but I'm pulling my hair out and could do with some good ideas please... I've developed an application which in .NET as a Windows service which is simply...
10
by: Andrei Ivanov | last post by:
Hello, it seems my postgresql data has somehow become corrupted (by a forced shutdown I think): psql template1 -U shadow Password: ERROR: nodeRead: did not find '}' at end of plan node...
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
1
by: Jim Heavey | last post by:
Hello, I am running into something strange. I am getting the following error when the program attempts to execute a particular procedure: An unhandled exception of type...
6
by: S Anand | last post by:
Is there any way to find out whether a record in the form is changed or not. Say we are having a customer Form, where user can create or view customers. When the user hits the Close/Exit icon, we...
1
by: rahman | last post by:
I know it should be very easy but I am new in ASP so I could not figured out. Here is the simplified version of my code: thePaymentID= request.querystring("IDValue") SQLqueryPayment= "SELECT...
26
by: Martin R | last post by:
Hi, How to find first not null value in column whitout chacking whole table (if there is a not null value then show me it and stop searching, the table is quite big)? thx, Martin *** Sent...
2
by: priya_sreejith | last post by:
how can we find whether a particular SQL recordset is present or not using VB ?
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
3
by: busybeeitsme | last post by:
hi friends how to find the record no.. ie what is the location of the particular record in the database.. i dont hav any s.no column in my database.. if a particular record is retrived from the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.