|
Hi all, I need import from excel to a table Sql-Server with asp.net and i am using vb.net, i have seen some sample but even I don't understand how work and all samples is in c# and i need vb.net.
I have my conexion to sql server in web.config
<appSettings>
<add key="ConnectionString" value="Data Source=Mymachine;Initial Catalog=Database;Persist Security Info=False;user id=User;password=******"/>
</appSettings>
for later I use a function for call it:
Public Shared Function ObtenerCadenaConexion() As String
Return ConfigurationManager.AppSettings("ConnectionString")
End Function
Someboy can help me? I need a sample easy for can import it from a web page
Thanks very much
|
|
|
|
|
The code you have written retrieves a connection from the web.config. It looks correct to me. What is the problem?
|
|
|
|
|
I believe that I explained bad, my problem is that I don't know import a sheet of excel to sql-server with my present connection.
Regards
|
|
|
|
|
Sandraa wrote: I don't know import a sheet of excel to sql-server with my present connection.
How do you want it imported?
Do you want the excel file to be inserted as a binary object? Or do you want the excel spreadsheet to be translated into tables?
|
|
|
|
|
I want import data from excel to a table sql-server. Not binary object.
And if is possible can use my present conection to sql server from web.config
Thanks
|
|
|
|
|
Sandraa wrote: And if is possible can use my present conection to sql server from web.config
The connection is the least of your problems.
Personally, I'd look at using something like SSIS for what you want (SQL Server Integration Services) because that is what it is good at: Taking data from one source and loading it into SQL Server.
|
|
|
|
|
I am beginner, I accept all solutions
The target is that from a web page a lot users can export data with a same template of excel in them hard disk to same table of sql-server. Later with all these data of table i will do web reports.
Is not possible create a form for upload these data because these users has all data in excel and they want continue using excel.
Thanks for help me.
|
|
|
|
|
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
|
|
|
|
|
I found the error, the problem was that this part
"SELECT * INTO T_Recibos " & _ "IN ''[ODBC;DRIVER={SQL Server};" & _ "Server=localmachine;" & _ "Database=NAMEDATABASE;" & _ "UID=Sandra;" & _ "PWD=Sandra]" & _ "FROM [Hoja1$]"
create a new table T_Recibos but I had it created in Sql-server, I changed it by T_Recibos2 (what doesn't exist) and work!
Now my problem is that I want to have a table (created into sql) and little to little that users add to it more rows from excel.
any idea?
|
|
|
|
|
i have created a com addin using .net , its works in local machine but its fails in other machines.
|
|
|
|
|
This does not sound like an appropriate question for an ASP.NET forum.
Please ask in the correct forum and provide sufficient detail that someone could potentially answer your question. For example: How does it fail in the other machine? What are the error messages? Are there any log messages anywhere?
|
|
|
|
|
i wanted install certificate in ie's trusted publisher.my code works fine in debug mode but its fails in iis.
|
|
|
|
|
your question is not clear. What does certificate has to do with debug mode? Rephrase your question and clarify what is the issue you have.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
In Wizard Control, we can jump one step to another by clicking NEXT. Now I also want to jump one step to another by clicking NEXT but after satisfying some specific conditions. Say, if(i==5) .
How? Please
shahdat
|
|
|
|
|
Capture the event and do some validation.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I have a page for sending an email to users.
When the target email is gmail, everything is OK, but when the email is going to be sent to a Yahoo address, it doesn't work! in this case not an error appears, not the mail is sent.
My host support says that it'd due to Yahoo.
Do you have any idea?
it's my code:
<br />
MailMessage message = new MailMessage();<br />
message.IsBodyHtml = true;<br />
message.Body = "";<br />
MailAddress mailAdrs = new MailAddress("support@myDomain.net", "support@myDomain.net");<br />
message.From = mailAdrs;<br />
message.Subject = "Reset Password Request";<br />
message.To.Add(txtEmail.Text);<br />
SmtpClient smtpC = new SmtpClient();<br />
smtpC.Host = "localhost";<br />
smtpC.Send(message);
Best wishes
|
|
|
|
|
The code that u posted will not work
|
|
|
|
|
You might want to be more specific. Why won't it work?
|
|
|
|
|
Is it being caught in the Yahoo spam trap?
Some spam filters work by working out if the IP address the email comes from matches the IP of the domain. If they do not match then you might want to look in to SPF[^]
|
|
|
|
|
No, it is not delivered at all. Not Inbox nor Spam.
I think it's related to SPF that you said.
You mean SPF of my domain, not Yahoo, don't you?
Best wishes
|
|
|
|
|
Like Colin said it could be going into the spam folder.
You may want to look into the message your sending. May be your email is flagged by Yahoo because it does not have message body and your wording for the subject line. You could try changing the subject and adding some message body.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
NO, I have message body,I've cleared it here. I used exactly this subject and this body in other domain and everything is OK. with this domain I have problem with Yahoo!
Best wishes
|
|
|
|
|
Then the issue is with Yahoo. You many be in their blocked list? what email are you using to send your emails
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
support@myDomain
Best wishes
|
|
|
|
|
Hello Friends,
I'm getting running processes using the Process.GetProcess() on localhost and my code is giving the output i want to. But after uploading on my server it throws following error
Access is denied
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: Access is denied
.........
And also i've already set <identity impersonate="true"/> and full trust level
|
|
|
|