Computers & Internet Logo

Related Topics:

Posted on Mar 09, 2017

Simlar problem while working with this code WebSerice file

OleDbCommand selectCommand;
OleDbDataAdapter oda;
DataSet ds = new DataSet();
selectCommand = new OleDbCommand();

connectionString = ''Provider=Microsoft.JET.OLEDB.4.0;'';
string Str_ColNames = objImportDB.get_importcol_sequence(Int_FeedId, '''');
Str_SelectText = ''SELECT '' + Str_ColNames + '' FROM [Sheet1$]'';
connectionString = connectionString + ''Data Source='' + fld_path + '';'';
ExtendedProperties = @''Extended Properties=''''Excel 8.0;IMEX=1;HDR=YES;'''''';




connectionString = connectionString + ExtendedProperties;
selectCommand.Connection = new OleDbConnection(connectionString);
selectCommand.CommandType = CommandType.Text;
selectCommand.CommandText = Str_SelectText;
selectCommand.Connection.Open(); // fails here reporting UnSpecified Error

But this code works fine if we do not use WebService

5 Related Answers

airoff

Alan Iroff

  • 160 Answers
  • Posted on Jul 16, 2008

SOURCE: vb 6.0 ado connection without ado control moving next record

I see 2 problems with your code.

1) Each time you call cmdnext_Click, you're reopening the database. Each time you do that, you start at the beginning of the file. You need to have the database opened once, somewhere else in your program. Be sure that the record set is visible from this sub.

2) In order to use the "Next" function, you need a loop like this

'test for no records
IF REC.BOF and REC.EOF then
msgbox "No Records Found"
exit sub
end if

IF NOT REC.EOF then
REC.MoveNext
(display your fields)
END IF


Again, this will only work if your database is opened outside of the cmdNext_Click routine.

Ad

Anonymous

  • 3 Answers
  • Posted on Jul 17, 2008

SOURCE: Use vb.net and access

Imports System
Imports System.IO
Imports System.Data
Public Class SaveImage
Shared Sub main()
Dim o As System.IO.FileStream
Dim r As StreamReader
Dim gifFile As String
Console.Write("Enter a Valid .Gif file path")
gifFile = Console.ReadLine
If Dir(gifFile) = "" Then
Console.Write("Invalid File Path")
Exit Sub
End If
o = New FileStream(gifFile, FileMode.Open, FileAccess.Read, FileShare.Read)
r = New StreamReader(o)
Try
Dim FileByteArray(o.Length - 1) As Byte
o.Read(FileByteArray, 0, o.Length)
Dim Con As New _ System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data
Source=Test.mdb")
Dim Sql As String = "INSERT INTO images (Pic,FileSize) VALUES (?,?)"
Dim Cmd As New System.Data.OleDb.OleDbCommand(Sql, Con)
Cmd.Parameters.Add("@Pic", System.Data.OleDb.OleDbType.Binary, o.Length).Value = FileByteArray
Cmd.Parameters.Add("@FileSize", System.Data.OleDb.OleDbType.VarChar, 100).Value = o.Length
Con.Open()
Cmd.ExecuteNonQuery()
Con.Close()
Catch ex As Exception
Console.Write(ex.ToString)
End Try
End Sub
End Class

Anonymous

  • 233 Answers
  • Posted on Dec 16, 2008

SOURCE: I had to restore my

I can't help you get this current problem solved.

However I can help you prevent it in the future.
Get a whopping BIG outside hard-drive for your backups.
Then you have ALL your back-up files on one continuous disk, instead of several.

You need a program that automatically backs-up only the files you have pre-selected, as an actual file and not an "Image".
Back-up such as Desktop, My Documents, Email, Favorites etc.
With "image" files you can not retrieve or copy and paste individual files from the archives, such as when you have accidentally deleted a good file on the computer.

Anonymous

  • 86 Answers
  • Posted on Aug 16, 2009

SOURCE: runtime error 2147467259 (80004005) in VB

either the database is in the wrong directory or it doesnt exist

Anonymous

  • 208 Answers
  • Posted on May 20, 2010

SOURCE: Restore reverts to C drive instead of E [zip disk]

Restore them to your C: as this is where your operating system is.

Ad

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

78 views

Ask a Question

Usually answered in minutes!

Top Cisco Computers & Internet Experts

Brad Brown

Level 3 Expert

19190 Answers

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3869 Answers

Kirk Augustin
Kirk Augustin

Level 3 Expert

2020 Answers

Are you a Cisco Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...