all groups > vj# > february 2006 >
You're in the

vj#

group:

Can J# accept Sun's Java only?


Can J# accept Sun's Java only? Indra Bayu
2/28/2006 8:00:27 PM
vj#: Hi, I'm in crisis for my final task.

First, can J# accept/filter only Sun's Java code?
I mean, J# has delegate, events, blablabla, while Java can't.
Can J# filter those?

Second, J# is somehow a little different compared to Java.
For example, it doesn't overload the conn.createStatement() method,
which is overloaded by Java.
I mean, how can I convert existing Java code(which takes parameters) to J#
code (which takes no parameters)?

Here's a sample J# code that wouldn't compile in Java:

import java.sql.*;

public class Test
{
public static void main(String [] args) throws Exception
{
try
{

Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");//RunTime error-1
Connection conn =
DriverManager.getConnection("jdbc:odbc:TestDatabase");
Statement stt = conn.createStatement();//Compile error-1
try
{
stt.executeUpdate("Create Table t (primaryKey int
Primary key)");
}
catch(Exception err)
{
//the table already exist
}
/* Read all rows and columns*/
ResultSet rs = stt.executeQuery("Select * from t");
while (rs.next())
{
myPrint(rs.getObject(1));//RunTime error-2
}
System.in.read();
}
catch(Exception err)
{
myPrint("Error occured!!!");
err.printStackTrace();
System.in.read();
}
}

public static void myPrint(Object message)
{
System.out.println(message.toString());
}
}

Please help me!
Any library, code, or link is going to be appreciated.
If my explanation is not clear, you can tell it to csharpindonesia@hotmail.com
Re: Can J# accept Sun's Java only? Homer J Simpson
3/1/2006 12:00:00 AM

[quoted text, click to view]


[quoted text, click to view]

AddThis Social Bookmark Button