问题描述
我正在使用 hcitool 从 iMx6 设备扫描蓝牙设备(Windows PC)。我运行了以下命令,结果“不支持操作”。我该如何解决这个问题?
public bool reserveRoom() //function for reserving a room
{
bool allow = true;
con.Open();
SqlCommand cmd = new SqlCommand("insert into Rooms (StudentID,RoomType,Date,StartingTime,DurationInHour,FinishingTime) values (@studentid,@roomtype,@date,@startingtime,@duration,@finishingtime)",con);
SqlCommand cmd2 = new SqlCommand("select StudentID from Students where TPEmail = '" + StudentEmail + "'",con);
SqlDataReader rd = cmd2.ExecuteReader();
int id = 0;
while (rd.Read())
{
id = rd.GetInt32(0);
}
rd.Close();
MessageBox.Show(Date.Date.ToString());
SqlCommand cmd3 = new SqlCommand("select StartingTime from Rooms where RoomType = '" + RoomType + "' and Date = '" + Date.Date.ToString("dd/MM/yyyy") + "'",con) ;
SqlCommand cmd4 = new SqlCommand("select count(*) from Rooms where RoomType = '" + RoomType + "'" + " and Date ='" + Date.Date.ToString("dd/MM/yyyy") + "'",con);
int count = Int32.Parse(cmd4.ExecuteScalar().ToString());
SqlDataReader rd2 = cmd3.ExecuteReader();
String[] startingTime = new string[count];
//int ident = 0;
int index = 0;
while (rd2.Read())
{
startingTime[index] = rd2.GetTimeSpan(0).ToString();
index += 1;
}
rd.Close();
cmd.Parameters.AddWithValue("@studentid",id);
cmd.Parameters.AddWithValue("@roomtype",RoomType);
cmd.Parameters.AddWithValue("@date",Date.Date);
string timeStart = (Time1 + ":" + Time2);
cmd.Parameters.AddWithValue("@startingtime",TimeSpan.Parse(timeStart));
double doubleDuration = Int32.Parse(DurationHour) + ((Double.Parse(DurationMinute)) / 60);
cmd.Parameters.AddWithValue("@duration",doubleDuration);
int hour = Int32.Parse(Time1) + Int32.Parse(DurationHour);
int min = Int32.Parse(Time2) + Int32.Parse(DurationMinute);
if (min >= 60)
{
min -= 60;
hour += 1;
}
string timeFinish = (hour + ":" + min);
cmd.Parameters.AddWithValue("@finishingtime",TimeSpan.Parse(timeFinish));
int i = cmd.ExecuteNonQuery();
if (i != 0)
{
MessageBox.Show("Reservation successful.");
}
else
MessageBox.Show("Unable to reserve");
foreach (string item in startingTime)
{
TimeSpan timeItem = TimeSpan.Parse(item);
if (Int32.Parse((timeItem - TimeSpan.Parse(timeFinish)).ToString()) >= 0)
{
MessageBox.Show("Accept");
}
}
con.Close();
return allow;
}
问候,
艾莎
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)