473,508 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to fix "missing return statement". error?

1 New Member
Getting "missing return statement" error for following code:

Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;
  2. public class DatabaseManager{
  3.   public static int add(String user,String password)throws Exception{
  4.     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  5.     Connection con=DriverManager.getConnection("jdbc:odbc:userRecords");
  6.     Statement st=con.createStatement();
  7.  
  8.  
  9.     String query="insert into UserRecords(userName,pass) values('"+user+"','"+password+"')";
  10.     System.out.println(query);
  11.  
  12.  
  13.     st.close();
  14.     con.close();
  15.   }
  16. }
Feb 5 '11 #1
1 3158
horace1
1,510 Recognized Expert Top Contributor
the method header
Expand|Select|Wrap|Line Numbers
  1. public static int add(String user,String password)throws Exception{
  2.  
states it returns an int result therefore the compiler expects a return statement. If you don't intend to rturn a result say the return type is void.
Feb 5 '11 #2

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

Similar topics

1
8029
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
4
3732
by: Loïc Delambre | last post by:
Hi, I have a service made in csharp language and I try to send message to network computer with the NetMessageBufferSend. Here's the import of the function : static extern int...
1
2409
by: Ryan Rife | last post by:
I'm trying to return a 401 statuscode to the client browser on my web site, however whenever I do this I get a 302 statuscode redirecting me to my login page. Any ideas on how to prevent the...
22
1528
by: Scot | last post by:
I have the following code: Dim IP, domainName As String domainName = "yahoo.com" Try IP = System.Net.Dns.GetHostByName(domainName).AddressList(0).ToString() Catch ex As Exception IP = "Not...
1
1118
by: bill.jenner | last post by:
In a situation where a raise event is normally used, how is this handled inside a web service. How is the user notified of an error. Do you simply have to have methods that return error values or...
1
3607
by: Xerxes | last post by:
Hi, I get the "Invalid return" error (in Javascript console) when I run this piece of code: <a href="javascript:if (document.dc_form.tn.value == ''' && document.dc_form.cid.value == '') {...
3
9785
oll3i
by: oll3i | last post by:
public ArrayList<String> wyswietlHistorieRachunku(String numer_konta) { try { BufferedReader br = new BufferedReader(new FileReader("konta//"+numer_konta+".txt")); ...
8
1839
sammyboy78
by: sammyboy78 | last post by:
I'm trying to create a class "WeeklyPay" that contains the methods that class "WeeklyPayTest" will use to compute the weekly pay of an employee when the user inputs employee name, hours worked, and...
1
2965
by: jedliu | last post by:
Hello all, I'm trying to do flagging in the craigslist.org, firstly it works, but when I used the WebProxy, it gave me this error: The remote server returned an error: (400) Bad Request This is...
1
3927
by: sajidk | last post by:
Hi All, I am very new to DB2 programming. I have written a SQL stored procedure and called it from C# . The program is working but it is not returning the error code and sqlstate code. If i...
0
7223
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,...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7036
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...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4705
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
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...

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.