|
 |
|
สอบถามปัญหา Visual C# ครับ จะเขียนให้รับค่า .HEX ของ JPEG ได้มั้ยครับ |
|
 |
|
|
 |
 |
|
อันนี้รับค่าของ rfid ซึ่งมี 8 หลัก แต่ .HEX มีไฟล์ใหญ่มาก
Code (C#)
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.IO.Ports;
using MySql.Data.MySqlClient;
namespace project2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
private string Connection = "Server=localhost;User Id=root; Password=pp34999; Database=monitora; Pooling=false";
private void Form1_Load(object sender, EventArgs e)
{
string[] Portnames = SerialPort.GetPortNames();
foreach (string n in Portnames)
{
comboBox1.Items.Add(n);
}
comboBox1.SelectedIndex = 0;
timer1.Start();
}
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
textBox1.AppendText(serialPort1.ReadLine());
//textBox1.Text = serialPort1.ReadExisting();
MySqlConnection Con = new MySqlConnection(Connection);
Con.Open();
string sql = "INSERT INTO monday(rfid,date,time)";
sql += "VALUES ('" + textBox1.Text + "','" + label1.Text + "','" + label2.Text + "')";
MySqlCommand cmd = new MySqlCommand(sql, Con);
cmd.ExecuteNonQuery();
Con.Close();
textBox1.Clear();
}
private void button1_Click(object sender, EventArgs e)
{
serialPort1.PortName = comboBox1.SelectedItem + "";
//serialPort1.PortName = comboBox1.Text;
serialPort1.Open();
}
private void timer1_Tick(object sender, EventArgs e)
{
label2.Text = DateTime.Now.ToLongTimeString();
label1.Text = DateTime.Now.ToLongDateString();
}
}
}
Tag : .NET, MySQL, Win (Windows App), C#, VS 2012 (.NET 4.x)

|
|
 |
 |
 |
 |
Date :
2013-02-06 22:39:34 |
By :
nook |
View :
897 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้แบบ Byte ได้หรือเปล่าครับ
Code (C#)
byte[] imbByte = new byte[fUpload.PostedFile.InputStream.Length + 1];
fUpload.PostedFile.InputStream.Read(imbByte, 0, imbByte.Length);
|
 |
 |
 |
 |
Date :
2013-02-07 09:47:09 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|