2016年4月19日 星期二

4/15期中考


3/25


3/18

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; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { private OleDbConnection connection = new OleDbConnection(); public Form1() { InitializeComponent(); connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\student\Downloads\WindowsFormsApplication14\WindowsFormsApplication14\bin\Debug\Database22.accdb"); } private void textBox3_TextChanged(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { connection.Open(); OleDbCommand command2 = new OleDbCommand(); command2.Connection = connection; command2.CommandText = "insert into 學生資料 (學生姓名,學生號碼,生日,性別) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; command2.ExecuteNonQuery(); connection.Close(); connection.Close(); } } }



3/11

package test; import java.sql.Connection; import java.sql.DriverManager; public class test1 { public static void main(String[] args) { // TODO Auto-generated method stub Connection c = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } System.out.println("Opened database successfully"); } }

123

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;
namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label2.Text = Convert.ToString(double.Parse(textBox1.Text) + double.Parse(textBox2.Text));
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = Convert.ToString(double.Parse(textBox1.Text) - double.Parse(textBox2.Text));
}
private void button3_Click(object sender, EventArgs e)
{
label2.Text = Convert.ToString(double.Parse(textBox1.Text) * double.Parse(textBox2.Text));
}
private void button4_Click(object sender, EventArgs e)
{
if (double.Parse(textBox2.Text) == 0)
{
label2.Text = " ";
MessageBox.Show("就不能用 0齁");
return;
}
label2.Text = Convert.ToString(double.Parse(textBox1.Text) / double.Parse(textBox2.Text));
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}