PDS8475
Active member
- Joined
- Jun 25, 2019
- Messages
- 41
- Programming Experience
- Beginner
HI
I am trying to check if a specific record exists in the database.
I am Using the following code
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The problem is that it checks that the values are anywhere in the database but not if they are in the same record. How would I go about checking that they are all in the same record?
	
		
			
		
		
	
				
			I am trying to check if a specific record exists in the database.
I am Using the following code
			
				C#:
			
		
		
		OleDbCommand check_All = new OleDbCommand("SELECT COUNT(*) FROM Donations WHERE EquipmentType = @TestType AND EquipmentMake = @TestMake AND EquipmentModel = @TestModel AND EquipmentSerial = @TestSerial", Testconnection);
                        check_All.Parameters.AddWithValue("@TestType", Type_comboBox.Text);
                        check_All.Parameters.AddWithValue("@TestMake", Make_textBox.Text);
                        check_All.Parameters.AddWithValue("@TestModel", Model_textBox.Text);
                        check_All.Parameters.AddWithValue("@TestSerial", Serial_textBox.Text);
                        //Testconnection.Open();
                        int AllExist = (int)check_Serial.ExecuteScalar();
                        if (AllExist > 0)
                        {
                            MessageBox.Show("All exists");
                        }
                        else
                        {
                            MessageBox.Show("All does not exist");
                        }The problem is that it checks that the values are anywhere in the database but not if they are in the same record. How would I go about checking that they are all in the same record?
 
	 
 
		 
 
		 
 
		 
 
		 
 
		