|
On what line does the error occur??
It looks like you missing a couple of parameters from the connection string, specifically HDR and IMEX.
HDR tells the provider that the first row of the sheet container header names for each column. IMEX tells it the any columns that are determined to have mixed type data, some rows as numbers, some as text, should be treated as a text column.
Also, at the end of the SQL statement, there is a FROM clause. Make sure the name specified (Sheet1 in this example) matches the name of the sheet in your Excel workbook. It should be the sheet name with a $ appended to it.
Imports System.Data.OleDb
.
.
.
If File.Exists(e.FullPath) Then
Dim connStr As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;HDR=Yes;IMEX=1", e.FullPath)
Dim conn As New OleDbConnection(connStr)
Dim ds As New System.Data.DataSet
Dim comm As New OleDbDataAdapter("SELECT INCIDENT_NO,INC_TYPE,ESTATE,TOWN,COUNTY,NAME_AND_PHONE_NO,CALLSIGN,[REASON MOBILISED]," & _
"MOBS_DT,MTI,INATT,STOP,MAV,AHS,OPERATOR_INFO FROM [Sheet1$]", conn)
comm.Fill(ds)
End If
|
|
|
|
|
Hi all, I have been attempting sending HTML formated emails with Inline images. the emails apear to be sent OK (no exceptions) however the email is 'lost' in space, My guess is that it is being blocked by the hosting/ISP company, when I send HTML mail without images - the email is sent and received fine, here is a sample code as I use it, (I also tried the AlternateView option with the same result)
Dim EM As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text)
Dim A As System.Net.Mail.Attachment = New System.Net.Mail.Attachment(txtImagePath.Text)
Dim RGen As Random = New Random()
A.ContentId = RGen.Next(100000, 9999999).ToString()
EM.Attachments.Add(A)
EM.Subject = txtSubject.Text
EM.Body = "<body>" + txtBody.Text + "<br><img src='cid:" + A.ContentId +"'></body>"
EM.IsBodyHtml = True
Dim SC As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient(txtSMTPServer.Text)
SC.Send(EM)
Any ideas how to solve this issue?
|
|
|
|
|
yaronbo wrote: My guess is that it is being blocked by the hosting/ISP company,
Probably true.
yaronbo wrote: Any ideas how to solve this issue?
Contact the ISP to see what they're blocking. It's possible you can't get around this at all because you're using a technique commonly used by spammers to try to get past spam filters.
|
|
|
|
|
I want to align DatagridView header to right. How can do this?
Gurudatta B. Shelke
|
|
|
|
|
hi,
select "ColumnHeaderDefaultCellStyle" property and click on ellipse button . this open a new window.
From this window you can select different property which is apply to Each Column Header of datagridview.
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Thanx Rupesh..
But my requirement is little bit different. 1st columns header should be left aligned and all others headers should be right aligned. I think i need to do it dynamically but how? can u tel me?
Gurudatta B. Shelke
|
|
|
|
|
try this:
dgv.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
the column at index 0 will be changed
hope it will help
edited :
oopppsss.... i posted code in C#, try to convert it
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
thanx once again..
yes I have tried that way also. like
DG_DISPLAY_MW.Columns(l).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
DG_DISPLAY_MW.Columns(l).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
this code works for Cell other than header cell. means they become right align but header cell is still left align.
Gurudatta B. Shelke
|
|
|
|
|
hi,
at design time, select the datagridview and click on smart tag(which is top right corner of the datagridview). Now select option "Edit column". when you Choosing this option , a small window is appear.Left hand side part of this window,show the column. choose any column and then select "DefaultCellStyle" property and click on ellipse button.Now once again a window appear. from this window you set alignment (and others) property for individual column .
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
i am working on word macro. i have to copy down selected headings from one document into another.
For that i want to read heading 1 so as to display them on labels on a form . Can anyone guide me in this.
|
|
|
|
|
I am developing an application using VB.Net. On backend I am using MS Access and SQL Server 2005 both. I want to Import data from MS Access table to SQL Server 2005 table using VB.Net. For example, I have a table on MS Access Database name "tblInternship". And I have a table with the same name on SQL Server 2005 Database. Now I want to Import data from Access.tblInternship to SqlServer.tblInternship using Vb.Net.
How I can do this. Please send me a code or make me understand to solve this problem.
|
|
|
|
|
Hi,
This can be done in the following manner in SQL query analyzer.
---------------------------------------------------------------------
BEGIN CODE
-- option 1
INSERT INTO sqltable (field1, field2, field3)
SELECT FIELD2, FIELD2, FIELD3
FROM OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\accessfile.mdb";
User ID=Admin;Password=',tablename)
-- option 2
INSERT INTO sqltable (field1, field2, field3)
SELECT FIELD2, FIELD2, FIELD3
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','c:\accessfile.mdb';'admin';'', tablename)
END CODE
---------------------------------------------------------------------
You may try the same thing using VB.Net.
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
hi,
i need to solve a problem can any one help
problems:
1. i've have some images in database,i want to make it scroll in my windows application when i select a particuler image it should display the details in the controls in that form
this problem should be solved using vb.net 2005 and sql server for database
|
|
|
|
|
Justin Pravin wrote: 1. i've have some images in database,i want to make it scroll in my windows application
Scroll?? Like how?
It sounds like you're going for more functionality than you need right now. Try just showing an image in a picture box and handling it's click event to get and show the details of whatever you need first. Then you can move on to making it look fancy.
|
|
|
|
|
how to i save time n date in to database....i just know the code for show time n date..
datetimepicker.value=datetimepicker.now
but how to i save it ....can i use the update same as textbox and combo box..example like receipt there is date on top...when end of month i need retrieve from 1/1/08 until 31/1/08 how i can write the code
i update the latest date,and i stil can retrieve previous date...
Me.TimeTableAdapter.Update(Me.timeDataSet.timeIn)
do u all can help me up thanks....
this problem should be solved using vb.net 2005 and sql server for database
modified on Monday, March 31, 2008 3:37 AM
|
|
|
|
|
Member 4442916 wrote: Me.TimeTableAdapter.Update(Me.timeDataSet.timeIn)
OK. This tells me you've already created your database table and created a DataSet in Visual Studio. What's the column type in the database that's holding this date/time stamp? Do you know any SQL, like how to use SELECT, INSERT, UPDATE, DELETE??
|
|
|
|
|
ya i had aready create database from employee to time table.which mean example employee when enter password..then the time will automatically store in to login/out table
i no some sql...but i'm not so clear bout that..isit
UPDATE LogIn AND LogOUT
WHERE EmployeeName="XXX"
can i do like this or
INSERT LOGIN
VALUES
|
|
|
|
|
What is the data type of the column in the database table that's holding the date and time?? If you're using anything other than DateTime, you're going to have a very difficult time with this.
|
|
|
|
|
Login and Out datatype in database is date/time...i use bound method
in database employee table link to logIn and Logout table...which mean one employee has many login/out time..
modified on Wednesday, April 2, 2008 10:08 AM
|
|
|
|
|
How can i suppress the group header section if there is no record return in detail section?
thanks in advance!!! ^-^
jyn
|
|
|
|
|
jhyn wrote: How can i suppress the group header section if there is no record return in detail section?
Isn't that done automatically?
|
|
|
|
|
Hi All,
I have created a customer database that contains customer details.
I have pasted a datagridview called CustomerDetailDatagridView that contains a list of the client details from the database.
In VB.net express 2008, is there a way I can filter the results of the datagrid simply by typing a name in a textbox just below the datagrid?
For e.g. I would like to type 'Jo' and all the entries with the term '*Jo*' will be returned (e.g. John, Johnathan etc).
Any help will be greatly appreciated...
A
|
|
|
|
|
Hello,
You can use the TextChanged() event of Textbox to filter the DataGridView.
Lets say, you have the following settings in Form_Load event of the application:
Me.OleDbDataAdapter1.Fill(DataSet11)
Me.BindingSource1.DataSource = DataSet11.Tables("Customers")
Me.DataGridView1.DataSource = Me.BindingSource1
Now in the TextChange() event, you can use the following code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = "" Then
Me.BindingSource1.Filter = ""
Else
Me.BindingSource1.Filter = "ContactName like '" & TextBox1.Text & "*'"
End If
End Sub
Now as you start typing in the textbox, it will start filtering the grid rows automatically.
I hope this will help.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hi All,
I am fairly new to programming in vb.net express.
I have downloaded a copy of vb.net express 2008 and was wondering how to open a crystal report from an application I have developed.
I have purchased a copy of crystal reports version 11 and created a new report that I have already linked into my database. (this report works fine when I double click and open it)
All I would like the application to do is when I click a button, I would like it to open my crystal report that I have saved on C:\temp.
Can I have step by step instructions please?
Abs
modified on Wednesday, April 2, 2008 2:39 AM
|
|
|
|
|
I have a web application in VS2008 VB.
I want to have a database check done at intervals. It seems to me that I should be setting it up using myapplication.startup - initiate a timer which does something useful every 30 minutes.
Trouble is, I can't figure out where my code goes. The MSDN article on how to add startup code directs me to menu options I cannot find. I get the general idea that I should have a file called "ApplicationEvents.vb" which has a startup event for class "myapplication" but it doesn't run the code.
I seem to remember using a config.web approach years ago, but I can't find a reference for that, either.
Thanks in advance.
Everyone else's job looks easy
|
|
|
|