473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to connect my oracleconnection

hi i am doing a program and i need to connect 5 projects in 1 solution but right now i am only doing the first project to be connected to the oracle connnection.

can you help me on how can i view the first name, middle name and last time on my textbox if i search the employee number ?
below is my code sample..
please help me..

Expand|Select|Wrap|Line Numbers
  1.         Try
  2.             Dim strempno As String
  3.             Dim rs As OracleAccess.clsOracleConnection
  4.             strempno = txtEmpno.Text
  5.             If strempno = "" Or strempno = " " Then
  6.                 MessageBox.Show("EmployeeNo is always necessary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  7.                 Call LSubfrmCnlenabled(False)
  8.                 rs.PFstrsConnect = True
  9.  
  10.                 txtEmpno.Text = "select EMPLOYEE_NO from M_EMPLOYEE;"
  11.                 txtFname.Text = "select FIRST_NAME from M_EMPLOYEE;"
  12.  
  13.             End If
  14.  
  15.         Catch ex As Exception
  16.             MessageBox.Show(ex.Message, "Error on btnOK", MessageBoxButtons.OK, MessageBoxIcon.Error)
  17.  
  18.         End Try
Feb 21 '07 #1
2 1105
kuzen
20
Hi
First of all empty field checking is a user machine process. You could use javascript, you can write it yourself or simply use visual required field validator for that.If there is an empty field, your application should never refer to the database.
For this, check the page validity in the beginning of your button_click event:
Expand|Select|Wrap|Line Numbers
  1. If not Page.Isvalid then
  2. return
  3. else
  4. ....
  5. end if
  6.  
About connection:

Import System.Data.OracleClient first.
dim yourconn as new OracleConnection
yourconn.connectionstring = "user id=...; data source=yourserver; password=..."
yourconn.open
dim yourcomm as new Oraclecommand
yourcomm.connection=yourconn
yourcomm.commandtype=commandtype.text
yourcomm.commandtext="your SQL query"
...
I hope I did not misunderstand you and this helps
Regards
Feb 21 '07 #2
Try
Dim strempno As String
Dim rs As OracleAccess.clsOracleConnection
Dim command As SqlCommand
Dim reader As SqlDataReader = command.ExecuteReader
strempno = txtEmpno.Text
Dim myconnection As SqlConnection
If strempno = "" Or strempno = " " Then
MessageBox.Show("EmployeeNo is always necessary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Call LSubfrmCnlenabled(False)
myconnection.ConnectionString = ("userId = username;" + "password = password;" + "datasource = Tasdi;")
myconnection.Open()
command.Connection = myconnection
command.CommandType = CommandType.Text
command.CommandText = ("select * from M_EMPLOYEE;")


If reader.HasRows Then

End If

End If

Catch ex As Exception
MessageBox.Show(ex.Message, "Error on btnOK", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

thank you for the help now what i did is at the above code..i don't know if i did it right my table name is M_EMPLOYEE and the fields are first name,, middle name and last name there are also birthday etc.. now this button is for the ok button because if i'm going to write an employee no. on the textbox(employeeno.) and i click on the button ok the the existing employee will view the following fields on the txtbox firstname, txtboxmiddlename, txtboxlastname and etc..I already inputed the "if read.hasrows for the starting to get the list from my sql but i'm not sure if im right...
Feb 22 '07 #3

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

Similar topics

3
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at...
1
by: CM | last post by:
Hi, when i want connect me in my BD with a JSP (with this simple code), this exception is throw. Thank's for ur help Mathieu CODE of my JSP ---------------------
1
by: Kevin Vogt | last post by:
When initially loaded, my web application (below) takes ~120000 milliseconds to open its connection. But repeated executions take 0 milliseconds each. But when I wait for approx. 5 minutes and try...
6
by: ´ď´ď | last post by:
How to connect asp.net with Oracle Database? Where and How to? Thanks very much.
2
by: blackdog | last post by:
I have Oracle client in my system, like to use csharp to communicate with Oracle server to retrieve data. I am very new in csharp, would anyone please give me an example codes or web pointer....
0
by: Big George | last post by:
Hello, I'm working with Visual Studio 2003 .NET and Crystal Reports for .NET. Database: Oracle 10g Develop PC: Windows XP I'm having problems trying to design a Crystal Report connecting to...
0
by: Francois Stander | last post by:
Hi, I am struggeling to connect to an Oracle db 10.2 through vb.net. Oracle client is installed on my maschine, Oracle.DataAccess in referenced in my app. this is how my code looks like: Dim...
6
by: Peter K | last post by:
Hi - is it the case that OracleConnection does not call close when the connection is disposed? For example, I use this sort of construct: using (OracleConnection conn = GetConnection()) {...
1
by: walterb | last post by:
I had a hard time finding this information on the web, so I decided to post it here for someone else. I was finding it difficult to locate information on the proper method to store the database...
2
by: Wendi Turner | last post by:
ASP.NET 2.0 C# WebService Connect to Database: Sql Server 2005 --------------------------------------------------------------------------------------------------- I have successfully created a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.