Hello, i need help in some subject i can't handle with for few days. lets say i have form that handle with some rent order (like....billiboards) after the user choose the number of the billboard and the Location and everything else, he need to choose 2 dates. one for the publish day and one for the getOFF day. i have odbc database that hold all the information about the billboards etc... how can i make some "if" or queries that will check that this billboard is not ordered in that range of days? for now i only have the insert handle. PLEASE HELP.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
namespace forumArt
{
public partial class addNewCampaign : Form
{
public addNewCampaign()
{
InitializeComponent();
}
private void addNewCampaign_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dataSet1.customers' table. You can move, or remove it, as needed.
this.customersTableAdapter.Fill(this.dataSet1.customers);
// TODO: This line of code loads data into the 'dataSet1.signsDetails' table. You can move, or remove it, as needed.
this.signsDetailsTableAdapter.Fill(this.dataSet1.signsDetails);
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (signNumber.Text == "")
{
MessageBox.Show("חובה לבחור את מספר השלט");
}
if (companyName.Text == "")
{
MessageBox.Show("נא לבחור את שם החברה המזמינה");
}
else
{
try
{
OdbcConnection conn = new OdbcConnection("dsn=forumArtDataBase");
OdbcCommand cmd = new OdbcCommand("insert into orders(signNumber,fromDate,toDate,companyName,comments) values ('" + signNumber.Text + "','" + fromDate.Text + "','" + toDate.Text + "','" + companyName.Text + "','" + comments.Text + "')", conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show("ההזמנה התווספה בהצלחה");
Close();
}
catch (OdbcException ex)
{
MessageBox.Show("התבצעה שגיאה בעת ניסיון ההתחברות למסד הנתונים" + ex);
}
}
}
}
}