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
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.
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
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.
SOURCE: runtime error 2147467259 (80004005) in VB
either the database is in the wrong directory or it doesnt exist
SOURCE: Restore reverts to C drive instead of E [zip disk]
Restore them to your C: as this is where your operating system is.
78 views
Usually answered in minutes!
×