473,787 Members | 2,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection to Sql and Explicit declaration

1 New Member
Hello,

I am very new to this site. before i start may i first introduce myself
i am 'Jhalil, a beginner Vb6 programmer. i stumbled on this site on my
quest for a code in vb that can connect me to either Microsoft sql or Mysql
server. Infact i was suprised to see people with different programming
problems. That is how i became a member of this good family.

Now can anybody help? i am a beginner in VB 6, i enjoy writing codes
but i do not know much of explicit declaration (option explicit), when i write
codes, i do not decalare, i use only Dataenvironment for my connection, and
my database is "Access" within Vb 6. Now my question:
I have a project containing one form (frm1), Database name Jhalil, Table name
is "Jjb", my database was created at c:\ directory. My form has three labels and
three textfield, lblname,lbladdr ess, lblphone; and txtname,txtaddr ess, and txtphone respectively. Can anyone help me with a code to connect to this database which reside at c:\ "through option" explicit declaration.
Feb 27 '08 #1
3 1345
jeffstl
432 Recognized Expert Contributor
Drag an ADO data control on to your form.

Check the properties, and you will see that you can build a simple database connection from this control with the properties.

If you want a more dynamic database connection you will have to probably have to declare your connection manually and check this site:

www.connections trings.com
Feb 28 '08 #2
Killer42
8,435 Recognized Expert Expert
Hi Jja. Welcome to TheScripts. :)

I'd just like to point out that you leave yourself open to a lot of problems by not using Option Explicit. Because allowing VB to automatically create variables any time you use them means that it will never tell you if you get a variable name wrong. This can make debugging your code very difficult. Take the following simple example...

Expand|Select|Wrap|Line Numbers
  1. For iiiiiii = 1 To 5
  2.     Debug.Print iiiiiiii
  3. Next
  4.  
If you think this would print the numbers 1 to 5, you've just demonstrated the very problem I was describing, because those are not the same variable. with Option Explicit set, VB would stop and tell you at compile time.

Obviously I've exaggerated the issue here for illustrative purposes by using such an obscure variable name, but believe me, the problem does occur.
Feb 29 '08 #3
Killer42
8,435 Recognized Expert Expert
ayshamalik, your post constituted a new question, so I've split it off to it's own discussion thread. I should tell you though, you'll need to be more specific about things like what version of VB you're using, and exactly what you want to do. If it's just how to connect to Oracle, that has been covered tons of times. Try the Search button at the top, or just read the responses in this thread.
Mar 2 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
3253
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy connection string' . When I write the string to the page using response.write(connectionstring) it shows up fine. Is the something else that I need to do? Thanks
1
5655
by: Stub | last post by:
Docs says that "The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction." I put up code of three cases at the bottom. Hope you can help me understand the "explicit" keyword and its usage. Specifically, Is "explicit" keyword only associated with constructor in C++? What's "implied conversion of types"?
1
1994
by: ranges22 | last post by:
****************************************************************** I am compiling a librarry which has a .h file containing th following: ****************************************************************** template<typename T> void from_string(const char Str, T &Obj); template<> void from_string(const char Str, long &); // template<> void from_string(const char Str, unsigned lon &); //
4
3527
by: Anthony England | last post by:
This is a simple question, which has been debated before, but can I ask it again with reference to a specific example? The question is basically should I close and set to nothing an ADO connection object? Normally, I would do this and not worry about whether I could have chosen not to bother. However, in this example, setting the variable to nothing can take ages, up to 15 seconds, and I wonder whether it is worth it. I would like a...
6
9008
by: John Kotuby | last post by:
Hi all, I am simply trying to include the Option Explicit declaration at the top of an ASP page and am getting an error: Error Type: Microsoft VBScript compilation (0x800A0400) Expected statement /transferkey.asp, line 2
5
1443
by: mlg1906 | last post by:
I'm developing an intranet site in ASP.NET 2.0 but I can't seem to connect to the DB from within my code. I've created a .vb class that houses a private Connection() that other functions within the class can call to connect to the database. In the calling function, I've declared my connection object and called the "Open" method on the object. However, when I attempt to execute the stored procedure command by calling the "ExecuteScalar"...
1
2323
by: petschy | last post by:
hello, i've run into an error when qualifying a copy ctor 'explicit'. the strange thing is that i get a compiler error only if the class is a template and declare the variable as X<Zx = y. X<Zx(y) is fine. Tested with gcc 2.95, 3.3, 4.1, all gave the same error: t.cpp: In function 'int main()': t.cpp:44: error: no matching function for call to 'D<int>::D(D<int>&)'
2
7699
by: Barry | last post by:
The following code compiles with VC8 but fails to compiles with Comeau online, I locate the standard here: An explicit specialization of any of the following:
12
7215
by: Rahul | last post by:
Hi Everyone, I have the following code and i'm able to invoke the destructor explicitly but not the constructor. and i get a compile time error when i invoke the constructor, why is this so? class Trial { public: Trial() {
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.