|
No, you must use the OleDb classes, or for more generic support, the Odbc class (I don't recommend them) to get to Access database. The Sql classes only work with SQL Server.
|
|
|
|
|
so how can I use bulk copy command for access database
|
|
|
|
|
You can't. Access doesn't have such a facility.
|
|
|
|
|
hello every one
i had problem of tabcontrol
i want to use the pages in tabontrol with select case but this doesnt work for that i tried code which is like:-
Private Sub docstatus()
Dim i As Integer
Select Case Me.tabcntrl.TabPages.IndexOf(i)
Case 0
Me.cmbbox1.Items.Insert(0, "NP")
end select
but this does not work....
so please help...

|
|
|
|
|
It looks like you're doing a check that you don't even need to do. i is always going to be 0 BTW. Since all the controls on all of the tabpages work, even if they're not visible yet, all you should have to do is update your combobox. You don't need the tabpage check.
|
|
|
|
|
but i want it to use it with select case as this is just an example of using combobox
i also have to use textbox an many of such controls so select case is in picture if the code i gave dose not work
than please suggest some another code which i could use with tabpages there are atmost
12 tabpages in single tabcontrol which i am using so i had to each time write same code in each selective index change of tabpages...
so please suggest me some another option ....

|
|
|
|
|
From your code, you'r updating a specific ComboBox or TextBox. Since no two controls can have the same name at design time, your obviously updating a specific control on a specific tabpage, reguardless if the tabpage is selected or not. So, why do you even need to check to see if the tabpage is in the collection??
|
|
|
|
|
The select Case statement is testing to see which tab page is selected. i.e. it is returning a tab page, not an index to the tab page. What you probably want is:
Select Case me.tabcntrl.SelectedIndex
Case 0
me.cmbbox1.items.insert(0, "NP")
case 1
case else
end select
- Robert Beaubien
- Kool Software LLC
- Try the New Warp10 Code Generator and Framework at https://www.warp-10.com
-
|
|
|
|
|
Can someone please tell me how to load multiple instances of the Same UserControl in a Windows Form? I've done this in ASP.NET, but for some reason in the Windows Form Environment I can only dynamically load a single instance of any given userControl.
The code below will put multiple controls on a form, but if I try a User Control, it only works the first time. After trying to load the second instance of the same user control, no errors that occur, but the Control Count of the Page does not increase, and the original user control remains unchanged.
Any help would be greatly appreciated. Thank you very much in advance!!!
Private id As Integer = 0
Private xAxis As Integer = 50
Private yAxis As Integer = 50
Dim x As UserControl1
x = New UserControl1
x.Name = "x" & id
Dim p As New Point(xAxis, yAxis)
x.Location = p
id += 1
yAxis += 50
Me.Controls.Add(x)
OR
Private id As Integer = 0
Private xAxis As Integer = 50
Private yAxis As Integer = 50
Dim x As TextBox
Dim p As New Point(xAxis, yAxis)
x = New TextBox
x.Name = "x" & id
x.Location = p
id += 1
yAxis += 50
Me.Controls.Add(x)
|
|
|
|
|
Without seeing more of the code, what you have now should work. It's probably because you're putting the control in the exact same place on the form every time. But, like I said, without a more complete code sample, it's impossible to tell.
|
|
|
|
|
Dave,
Thank you for the quick feedback, but there is something else going on that neither of us are seeing yet.
The control count in the page does not increase when additional controls are added. In addition, I am incrementing the location each time that code snippet is being run
- xAxis, yAxis, and id are private variables (see previous snippet). In the user control, all i have in it for now is a combobox (until i get this working and then I'll put the user control I need back). When I take out "MyUserControl" and replace it with combo box, the code works fine.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As MyUserControl
Dim p As New Point(xAxis, yAxis)
x = New MyUserControl
x.Name = "x" & id
x.Location = p
id += 1
yAxis += 50
Me.Controls.Add(x)
End Sub
|
|
|
|
|
If the code works if you replace MyUserControl with a TextBox, then there's something with your UserControl. Did you design it as a Singleton??
|
|
|
|
|
No, it was not designed as Singleton because I want to have multiple, seperate instances of the user control.
Below is the code for the User Control that I am using to try and figure out what this issue is (Obviously, my "real" user control will have a lot of functionality).
Public Class UserControl1
Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
|
|
|
|
dear friends,
i am new to vb6 programming,i want to upload excell file data to access table,my excel file table Header is like this:
[ExchOrder Ref. No] [Symbol] [Series] [B/S] [Exec.Qty] [Investor ID] [App TimeStamp] [Exch] [Trade Price] [Trade Value] [Sett.No] [Order Ref. No] [ExchTrade Ref. No] [Exch TimeStamp] [SenderID] [Trade Ref. No] [Segment]
here the Squre bracket is given by me.i know the connection statement for the excell file whre header has no space and special character.
and access table field names are same without space and dot.
kindly help
thk in advance
|
|
|
|
|
I'd drop VB6 and move on to VB.NET - you can download one of the free Express IDE's at the Microsoft website[^]. You'll find quite some examples on reading from Excel and writing to Access on this site.
A word of warning for the 'special characters' though; in Excel they are but a label for the column, and you can give the column any name you want. Access is somewhat more restrictive there. Some SQL-tools won't work decently if the tablenames have 'strange' characters.
I are troll
|
|
|
|
|
Hi,
I am having a very simple problem perhaps. I am using visual studio 2008 and have input an access data file called db1.mdb from hard disk. This contains a file called Sheet1. I would like to connect to that database from my form. I am using following code which says connection failure. My file contain no password and username.
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=db1.mdb")
Please help me
|
|
|
|
|
is the .mdb file in the same folder your .exe is in??
|
|
|
|
|
|
OK, then try
- adding a semi-colon
- adding a default account and empty password
- adding an empty account and password
- using full path
This works for me: connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+file+";User Id=admin;Password=;"; where file is a string containing the full path.
This article is an introduction to using MDB files: Using ADO.NET for beginners[^]

|
|
|
|
|
Hi,
Try "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db1.mdb"
good luck
NajiCo
|
|
|
|
|
That works for ClickOnce deployed applications. If you're not using ClickOnce, it's pretty much useless.
|
|
|
|
|
Hi Dave,
Actualy, using "|DataDirectory|" is very helpful to locate a database in the app's folder, it's not restricted to ClickOnce, just give it a try!
best regards,
NajiCo
|
|
|
|
|
Naji El Kotob wrote: is very helpful to locate a database in the app's folder
That's the one place I never put a database. In most corporate environments I've been in, Program Files is ReadOnly, unless absolutely necessary.
|
|
|
|
|
|
Hi,
Great ... on the other hand, check Dave's comment regarding the location of database!
best regards,
|
|
|
|