Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #306
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| From | "Starbuck" <starbuck@THRWHITE.remove-dii-this> |
| Subject | java and ms-server |
| Message-ID | <eLYMk.23884$7q6.21735@newsfe10.ams2> (permalink) |
| X-Comment-To | comp.lang.java.databases |
| Newsgroups | comp.lang.java.databases |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 56 |
| Date | Wed, 27 Apr 2011 15:22:59 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303917779 96.60.20.240 (Wed, 27 Apr 2011 10:22:59 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:22:59 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.databases:306 |
Show key headers only | View raw
To: comp.lang.java.databases
Hi Folks
New to the group to sorry if this has been asked before.
I am learniing Java at Uni and so far I have connected to a MS Server
and I have read data ok. Now I want to connect to the stored procedures
already in place.
Below is a procedure in question -
CREATE PROCEDURE record_count
(
@cnt int OUTPUT
)
AS
BEGIN
/* Procedure body */
SELECT @cnt = count(8)
From curry
END
Nice and easy returns number of records in table.
Here is my working c# code
public int recCount()
{
try
{
openCon();
//not sure from here peeps
SqlCommand cmd = new SqlCommand("record_count", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter countParameter = new SqlParameter("@cnt", 0);
countParameter.Direction = ParameterDirection.Output;
cmd.Parameters.Add(countParameter);
cmd.ExecuteNonQuery();
int rc =
Int32.Parse(cmd.Parameters["@cnt"].Value.ToString());
if (con.State == ConnectionState.Open) con.Close();
return rc;
}
catch (Exception ex)
{
string exx = ex.Message ;
return 0;
}
}
Can anyone point me in the correct direction for the Java method please.
Many thankings in advance.
KC
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.databases | Previous | Next — Next in thread | Find similar
java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "David Harper" <david.harper@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "John W Kennedy" <john.w.kennedy@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Martin Gregorie" <martin.gregorie@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
csiph-web