using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace 圣经投屏
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string juan = textBox1.Text;
string zhang = numericUpDown1.Text;
string start = numericUpDown2.Text;
string end = numericUpDown3.Text;
try
{
int izhang = Convert.ToInt32(zhang);
int istart = Convert.ToInt32(start);
int iend = Convert.ToInt32(end);
if (izhang > 200 || istart > 200 || iend > 200)
{
return;
}
}
catch (Exception)
{
return;
}
if (juan.Equals("") || zhang.Equals("") || start.Equals("") || end.Equals(""))
{
return;
}
richTextBox1.Text = "";
using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=bibleNosound.mdb"))
{
using (OleDbCommand cmd = new OleDbCommand("SELECT py, fullname, chaptersn, versesn, strjw from bibleid,bible where bibleid.sn = bible.Volumesn and py = @py and chaptersn = @zhang and versesn between @start and @end", conn))
{
conn.Open();
cmd.Parameters.AddWithValue("juan", juan);
cmd.Parameters.AddWithValue("chaptersn", zhang);
cmd.Parameters.AddWithValue("start", start);
cmd.Parameters.AddWithValue("end", end);
using (OleDbDataReader odr = cmd.ExecuteReader())
{
int i = 0;
while (odr.Read())
{
if (i % 3 == 0)
{
richTextBox1.SelectionColor = Color.Aqua;
}
else if(i%3==1)
{
richTextBox1.SelectionColor = Color.Magenta;
}
else
{
richTextBox1.SelectionColor = Color.Yellow;
}
richTextBox1.SelectionStart = richTextBox1.TextLength;
richTextBox1.AppendText(odr[2].ToString() + ":" + odr[3].ToString() + odr[4].ToString() + (char)13);
i++;
}
}
}
}
richTextBox1.Select(0, 0);
richTextBox1.Focus();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("可供青岛市各大教会免费使用,禁止用作商业用途。开发:丁林");
}
}
}