C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET WebForms »

Insert Records in Excel Sheet Using VB.NET


Posted Date: 23 Oct 2009    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Gopal Singh RathoreMember Level: Silver    
Rating: 1 out of 5Points: 8



Hello Dear Friends,

Below is the code for enter records in Excel Data Sheet......


--------------------------

Name: Text Box For Name

Address: Text Box For Address

Insert Reset


-----------------------------------------------------------

--------------------------
Code of inserttexcell.aspx
--------------------------



Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsertData.Click

Dim MyConnection As New System.Data.OleDb.OleDbConnection
Dim myCommand As New System.Data.OleDb.OleDbCommand
Dim strSQL As String

Try
MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("CustomerInformation.xls") & ";" & _
"Extended Properties=Excel 5.0;")

MyConnection.Open()
myCommand.Connection = MyConnection
strSQL = "Insert into [Sheet1$] values('" + TextBox1.Text + "', '" + TextBox2.Text + "')"
myCommand.CommandText = strSQL
myCommand.ExecuteNonQuery()
MyConnection.Close()

Catch ex As Exception
MsgBox(ex.ToString)
Return
End Try
Response.Write("Record Enter Sucessfully")

End Sub


Attachments

  • Insert Records in Excell Sheet Using VB.NET (34339-231457-Insert-Records-in-Excell-Sheet-VB.txt)


  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    Insert Records in Excell in VB.NET  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Showing Data From Excel Using OLEDB
    Previous Resource: Set Focus of a Control in ASP.NET
    Return to Discussion Resource Index
    Post New Resource
    Category: ASP.NET WebForms


    Post resources and earn money!
     
    More Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use