我用substring把他们无规则的截取怎么保存到数据库中
我用的是richTextBox1控件读了一串数据我用substring把他们无规则的截取了8个字段。我想把它存到数据库中。我现在已经定义好了一个dal方法是
public static bool Add(VehicleInfo record)
{
string sql="insert into VehicleInfo(vehicleid,gpsdirection,command,vehiclestate,dateline,gpsvalidity,gpsspeed,longitude,latitude) values('" + record.VehicleID.ToString() + "','"+ record.GPSDirection.ToString() + "','"
+ record.Command.ToString() + "','" + record.Vehiclestate.ToString() + "','" + record.DateLine.ToString() +"','"+ record.GPSValidity.ToString() +"','"+ record.GPSSpeed.ToString() +"','"+ record.Longitude.ToString() +"','"+ record.Latitude.ToString() +"')";
return ExecuteSql(sql);
}
private void button2_Click(object sender, EventArgs e)
{
string str = this.richTextBox1.Text.ToString();
string read1 = str.Substring(0, 4);
string read2 = str.Substring(5, 2);
string read3 = str.Substring(7, 2);
string read4 = str.Substring(9, 4);
string read5 = str.Substring(13, 6);
string read6 = str.Substring(19, 1);
string read7 = str.Substring(20, 2);
string read8 = str.Substring(23, 8);
string read9 = str.Substring(31, 8);
)
但是截取了之后我不知道怎么调用。谢谢那位高手指点指点。急!!!!