将数据插入Excel ..... [英] Inserting data into Excel.....
本文介绍了将数据插入Excel .....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在VB.Net上做了一个应用程序。当我点击保存按钮时,数据存储在Access数据库中。但是如何在vb.net中将数据插入(Excel和Access)。下面我发布了将数据插入访问数据库的代码....
*************************** *********** 888
代码---------------
-------------------
I have made an application in VB.Net. When i click on save button the data is stored in Access database.But how to insert data into both (Excel and Access) in vb.net. Below I have posted code to insert data into access database....
**************************************888
code---------------
-------------------
con.Open()
ss = "insert into swap(srno,vcno,old_stb,new_stb,dname,swapby,swapdate,status)values(@srno,@vcno,@old_stb,@new_stb,@dname,@swapby,@swapdate,@status)"
com = New OleDbCommand(ss, con)
com.Parameters.AddWithValue("@srno", TextBox1.Text)
com.Parameters.AddWithValue("@vcno", txtvc.Text)
com.Parameters.AddWithValue("@old_stb", txtostb.Text)
com.Parameters.AddWithValue("@new_stb", txtnstb.Text)
com.Parameters.AddWithValue("@dname", txtdname.Text)
com.Parameters.AddWithValue("@swapby", txtsb.Text)
com.Parameters.AddWithValue("@swapdate", DateTimePicker1.Text)
com.Parameters.AddWithValue("@status", ComboBox1.SelectedItem.ToString())
com.ExecuteNonQuery()
MsgBox("Data Saved Successfully", MsgBoxStyle.Information)
con.Close()
推荐答案
请参阅使用MS Excel(xls / xls) x)使用MDAC和Oledb [ ^ ]。
这篇关于将数据插入Excel .....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文