|
I got it alright,
moral of the story is eventhough u are using an Access db, use standard wildcards used in sql.
Thanks!!!!
|
|
|
|
|
in addition I'd like to add (because I just had a simaler program where I encounterd this problem) that the wildcard * (or %) will not return 'null' values. (I haven't found any wildcard that will in access) so you will need to make shure that there is always a value in you're db fields otherwise I'm afraid you search will not work perfectly
|
|
|
|
|
|
Hi All
I am looking for a way to let the users of my applications change the database connection in runtime. The database is SQL and the application is written in VB.NET
|
|
|
|
|
You would need to store the database name and user/password info somewhere locally with your user (an .ini file, registry, access database etc) and read the information from there into a variable, then use the variable in your vb.net code to instantiate the database connection.
Hope this helps.
-------------------------------------------
Damian - Insert snappy one-liner here.
|
|
|
|
|
This is the problem I would like help with, how do I (use the variable in your vb.net code to instantiate the database connection) at runtime
|
|
|
|
|
example:
private con as string = ""
load (of program)
con = "this is the connectionstring)
button_click (user clicked a button) (can be something else ofcourse)
clsda.connectionstring = con (clsda is where you do all you're connecting to the sql server (something I always do could be you use something else))
hope this helps
|
|
|
|
|
Could I have a working sample, I'm really confused. I am kind of new in this area.
|
|
|
|
|
give me a couple minutes I'll see what I can box together
|
|
|
|
|
ok have a small example here's the code (bit much but since I can't attach it no choice)
<code>
Public Class Form1
Private con1 As String
Private con2 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con1 = "Server=999.999.999.999;Database=master;user ID=master;Password=master;Trusted_Connection=false"
con2 = "Server=000.000.000.000;Database=master;user ID=master;Password=master;Trusted_Connection=false"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
clsDA.msConnectie = con1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
clsDA.msConnectie = con2
End Sub
End Class
Imports System.Data.SqlClient
Public Class clsDA
Public Shared msConnectie As String
Public Shared Function GetDR(ByVal sSQL As String, ByVal ParamArray dbParams() As SqlParameter) As SqlDataReader
Dim oCommand As SqlCommand
Dim oDataReader As SqlDataReader
Dim ocon As SqlConnection
Try
ocon = New SqlConnection(msConnectie)
ocon.Open()
oCommand = ocon.CreateCommand
oCommand.CommandType = CommandType.Text
oCommand.CommandText = sSQL
For Each opar As SqlParameter In dbParams
oCommand.Parameters.Add(opar)
Next
oDataReader = oCommand.ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As SqlException
...
End Try
Return oDataReader
End Function
End Class</code>
hope this helps
|
|
|
|
|
|
Hi,
i like to get my projects startup path in VBA, i.e., how to find the installed folder of an application.
I got the code in VB.NET but my requirement is to get in VBA as macro
My.Application.Info.DirectoryPath.ToString
Thanks,
Nanda
|
|
|
|
|
If you are using VBA, I assume you are using MS Access. This is how to get the path for the current database in Access:
Application.CurrentProject.Path
Hope this helps.
-------------------------------------------
Damian - Insert snappy one-liner here.
|
|
|
|
|
One way of doing it is the next
currentdb.name
this will return the full path with the database name
|
|
|
|
|
am using MS word template, and no databases are used.
pls help me in this.
Thanks,
Nanda
|
|
|
|
|
try this
Dim s As String
s = CurDir
s = CurDir$
s = Application.Path
s = ThisDocument.Path
s = ActiveDocument.Path
I hardly ever use word so I'm not that good at it but these seme to return serveral path's maybe one of them is what you want
|
|
|
|
|
how can i send serial data over the ethernet using the vb.net code?
|
|
|
|
|
What do you mean by "serial data".
You send the data according to the specifications of the server that is listening for it. Without knowing that, or knowing how your going to write the server, sending it is a moot point.
|
|
|
|
|
hello frnds,
how can i send a mil using MSoutlookExpress which is should be view in the reciever Draft folder,
means i want to send a mail over my LAN and my inputs are reciever mail id,message,subject and when i send mail then it should be view in the reciever Draft folder
I am using vb.Net 2.0
hope u all understand...Pls help..
any one have code OR any helpgul Link ????
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
koolprasad2003 wrote: how can i send a mil using MSoutlookExpress which is should be view in the reciever Draft folder,
You cannot target a folder on the receivers end. It will only show up in their Inbox folder, and if the receiver has any sorting rules in place, the receiver moves it to an appropriate folder.
|
|
|
|
|
thankx for reply..
have you any code sample to send the mail using outlookexp ????
please help....
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You don't use Outlook Express to send emails from your code. Outlook Express is/was a wrapper for MAPI. All you have to do is Google for "VB.NET MAPI".
Or, if you're using .NET 2.0 (VB.NET 2005), look at the classes in the System.Net.Mail[^] namespace.
|
|
|
|
|
koolprasad2003 wrote: it should be view in the reciever Draft folder
You can not stipulate that type of conditions. It is upto the user's email client and filtering rules to decide the routing.
Also note that, Drafts are normally used to store message in composition before being submitted for delivery to Outbox and then to the SMTP server.
|
|
|
|
|
thankx for reply..
have you any code sample to send the mail using outlookexp ????
please help....
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
heres the code
Dim handle As IPictureDisp
handle= getbinerydata();
me.imageCtrl.Picture=handle;
this code works fine in vb6. but doesn't work in VBA(msaccess).
the message is (file not found).
how to show bitmap variable in image control.
Asif Rehman
|
|
|
|