Click here to Skip to main content
15,921,905 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Import sheet excel to table in Sql Server with Asp.net (VB) Pin
Sandraa29-Mar-09 0:53
Sandraa29-Mar-09 0:53 
somebody can help me? I have this code of a button the idea is export from excel to a table of sql-server but i received a OleDbException "ODBC: falló la llamada." that the translate is "ODBC: error failed the call"

I put you my code:
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb

Partial Class Formularios_ImportarExcel
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

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

        Dim connString As String = _
            "Provider = Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source = C:\test.xls;" & _
            "Extended Properties = 'Excel 8.0;HDR=Yes'"

        Dim cnn As New OleDbConnection(connString)

        Try
            Dim sql As String = _
                "SELECT * INTO T_Recibos " & _
                "IN ''[ODBC;DRIVER={SQL Server};" & _
                     "Server=localmachine;" & _
                     "Database=NAMEDATABASE;" & _
                     "UID=Sandra;" & _
                     "PWD=Sandra]" & _
                "FROM [Hoja1$]"

            Dim cmd As New OleDbCommand(sql, cnn)

            cnn.Open()

            Dim n As Integer = cmd.ExecuteNonQuery()

            Label1.Text = "Número de registros afectados: " & n.ToString

        Catch ex As OleDbException
            Label1.Text = (ex.Errors(0).Message)

        Catch ex As Exception
            Label1.Text = (ex.Message)

        Finally
            cnn.Close()
            cnn = Nothing

        End Try
    End Sub

GeneralRe: Import sheet excel to table in Sql Server with Asp.net (VB) Pin
Sandraa29-Mar-09 1:41
Sandraa29-Mar-09 1:41 
Questioncom addin setup fails Pin
aaru24x728-Mar-09 5:25
aaru24x728-Mar-09 5:25 
AnswerRe: com addin setup fails Pin
Colin Angus Mackay28-Mar-09 9:29
Colin Angus Mackay28-Mar-09 9:29 
Questiondebug mode works but its fails in iis Pin
aaru24x728-Mar-09 5:23
aaru24x728-Mar-09 5:23 
AnswerRe: debug mode works but its fails in iis Pin
Yusuf29-Mar-09 8:20
Yusuf29-Mar-09 8:20 
QuestionHow to go from Step1 to Step2 by satisfying specific conditions using Wizard Control Pin
Shahdat Hosain28-Mar-09 4:46
Shahdat Hosain28-Mar-09 4:46 
AnswerRe: How to go from Step1 to Step2 by satisfying specific conditions using Wizard Control Pin
Christian Graus28-Mar-09 11:08
protectorChristian Graus28-Mar-09 11:08 
QuestionSend Mail To Yahoo! Pin
mehrdadc4828-Mar-09 2:16
mehrdadc4828-Mar-09 2:16 
AnswerRe: Send Mail To Yahoo! Pin
Nazrul28-Mar-09 4:50
Nazrul28-Mar-09 4:50 
GeneralRe: Send Mail To Yahoo! Pin
Colin Angus Mackay28-Mar-09 9:40
Colin Angus Mackay28-Mar-09 9:40 
AnswerRe: Send Mail To Yahoo! Pin
Colin Angus Mackay28-Mar-09 9:39
Colin Angus Mackay28-Mar-09 9:39 
GeneralRe: Send Mail To Yahoo! Pin
mehrdadc4828-Mar-09 19:38
mehrdadc4828-Mar-09 19:38 
AnswerRe: Send Mail To Yahoo! Pin
Yusuf28-Mar-09 11:24
Yusuf28-Mar-09 11:24 
GeneralRe: Send Mail To Yahoo! Pin
mehrdadc4828-Mar-09 19:41
mehrdadc4828-Mar-09 19:41 
GeneralRe: Send Mail To Yahoo! Pin
Yusuf29-Mar-09 8:21
Yusuf29-Mar-09 8:21 
GeneralRe: Send Mail To Yahoo! Pin
mehrdadc4829-Mar-09 17:38
mehrdadc4829-Mar-09 17:38 
QuestionAccess is denied in Processs.GetProcess(.....) Pin
.NET- India 28-Mar-09 1:30
.NET- India 28-Mar-09 1:30 
AnswerRe: Access is denied in Processs.GetProcess(.....) Pin
Colin Angus Mackay28-Mar-09 9:27
Colin Angus Mackay28-Mar-09 9:27 
QuestionAsk regarding google map controls in ASP.net with c# Pin
vidhi_2228-Mar-09 1:26
vidhi_2228-Mar-09 1:26 
AnswerRe: Ask regarding google map controls in ASP.net with c# Pin
Christian Graus28-Mar-09 12:10
protectorChristian Graus28-Mar-09 12:10 
GeneralRe: Ask regarding google map controls in ASP.net with c# Pin
vidhi_2229-Mar-09 23:17
vidhi_2229-Mar-09 23:17 
AnswerRe: Ask regarding google map controls in ASP.net with c# Pin
vinodkrebc29-Mar-09 23:32
vinodkrebc29-Mar-09 23:32 
QuestionHow can I get a computer's organizational unit from the Active Directory? Pin
Nada Adel28-Mar-09 1:26
Nada Adel28-Mar-09 1:26 
Questionsql server 2005 Pin
anup keshari28-Mar-09 1:11
anup keshari28-Mar-09 1:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.