and
settings\all
users\application
data\mysql\mysql
server
5.1\data
2、mysql如果使用innodb存储引擎,mysql数据库文件类型就包括.frm、ibdata1、.ibd,存放位置有两个,
.frm文件默认存放位置是c:\documents
and
settings\all
users\application
data\mysql\mysql
server
5.1\data,
ibdata1、.ibd文件默认存放位置是mysql安装目录下的data文件夹
可以先把文件的内容读取出来存储到一个string中,然后用c#连接数据库,利用insert语句,插入到数据库中sqlConnection conn=new sqlConnection("/*链接字符串*/")
string sqlstr="insert into tableName values(content)"
sqlCommand cmd=new Sqlcommand(conn,sqlStr)
cmd.executeNonquery()
只是一个思路,你尝试看
下面的是打开文本文件的代码,你打开后,按照我上面说的内容做就可以了
private void fileOpen_Click(object sender, EventArgs e)
{
string path
OpenFileDialog OpenFile = new OpenFileDialog()
OpenFile.Title = "打开"
OpenFile.InitialDirectory = @"桌面"
OpenFile.Filter = "文本文件(*.txt|*.txt*.doc)"
DialogResult drResult = OpenFile.ShowDialog()
if (drResult == DialogResult.OK)
path = OpenFile.FileName
else
return
StreamReader myReader
myReader = new StreamReader(path)
strHeight = myReader.ReadToEnd()
myReader.Close()
}
#include#include#includeintmain(){FILE*fin,*foutinta,b,c,d,sfin=fopen("f1.txt","r")//原始数据文件fout=fopen("f2.txt","w")//保存结果文件fscanf(fin,"%d%d%d%d",&a,&b,&c,&d)while(!feof(fin)){s=(int)sqrt((a-b)*(a-b)+(c-d)*(c-d))fprintf(fout,"%d\n",s)fscanf(fin,"%d%d%d%d",&a,&b,&c,&d)}fclose(fin)fclose(fout)}欢迎分享,转载请注明来源:内存溢出
评论列表(0条)