Click here to Skip to main content
15,891,849 members
Home / Discussions / Database
   

Database

 
AnswerRe: DateTime from concatenated string Pin
Eddy Vluggen15-Oct-09 4:35
professionalEddy Vluggen15-Oct-09 4:35 
GeneralRe: DateTime from concatenated string Pin
Jay Royall15-Oct-09 4:41
Jay Royall15-Oct-09 4:41 
QuestionHelp with the Following SQl Logic Pin
Vimalsoft(Pty) Ltd15-Oct-09 2:11
professionalVimalsoft(Pty) Ltd15-Oct-09 2:11 
AnswerRe: Help with the Following SQl Logic Pin
Vimalsoft(Pty) Ltd15-Oct-09 2:50
professionalVimalsoft(Pty) Ltd15-Oct-09 2:50 
QuestionNeed to add where rownum between 0 and 0 + 6 -1 in a query Pin
anbusenthil15-Oct-09 0:42
anbusenthil15-Oct-09 0:42 
AnswerRe: Need to add where rownum between 0 and 0 + 6 -1 in a query Pin
Niladri_Biswas30-Oct-09 21:11
Niladri_Biswas30-Oct-09 21:11 
QuestionReplication problem Pin
krishnaveer14-Oct-09 21:45
krishnaveer14-Oct-09 21:45 
Questionerror with OUTPUT Pin
Jassim Rahma14-Oct-09 8:58
Jassim Rahma14-Oct-09 8:58 
I am trying to OUTPUT a data from the SP but getting this error:

System.InvalidOperationException was unhandled
  Message="String[5]: the Size property has an invalid size of 0."
  Source="System.Data"
  StackTrace:
       at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
       at System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters)
       at System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at The_Internet_Cafe_System.frmMain.connect_to_host() in C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Internet Cafe\Internet Cafe\main_form.cs:line 206
       at The_Internet_Cafe_System.frmMain.timerHost_Tick(Object sender, EventArgs e) in C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Internet Cafe\Internet Cafe\main_form.cs:line 496
       at System.Windows.Forms.Timer.OnTick(EventArgs e)
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at The_Internet_Cafe_System.Program.Main() in C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Internet Cafe\Internet Cafe\Program.cs:line 35
  InnerException: 


this is my SP:

USE the_internet_cafe
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_update_account_on_host]
	@system_guid uniqueidentifier,
	@net_qty int,
	@net_amount money,
	@items_qty int,
	@items_amount money,
	@banner_file varchar(255) output
AS
BEGIN
	SET NOCOUNT ON;

	UPDATE internet_cafe SET net_qty = @net_qty, net_amount = @net_amount, items_qty = @items_qty, items_amount = @items_amount, last_connected = getdate() WHERE system_guid = @system_guid

	SET @banner_file = (SELECT banner_file FROM banners WHERE banner_id = 1)
END


and this is my C# code:

private void connect_to_host()
{
    // connect to host to update details and get random banner;
    sql_connection = new SqlConnection("Data Source=.\\TICSSQL;initial catalog=the_internet_cafe;integrated security=true;");
    sql_connection.Open();

    sql_command = new SqlCommand("sp_update_account_on_host", sql_connection);
    sql_command.CommandType = CommandType.StoredProcedure;

    sql_command.Parameters.Add("@system_guid", SqlDbType.VarChar).Value = Properties.Settings.Default.system_net_cafe_guid;
    sql_command.Parameters.Add("@net_qty", SqlDbType.Int).Value = Properties.Settings.Default.system_net_qty;
    sql_command.Parameters.Add("@net_amount", SqlDbType.Money).Value = Properties.Settings.Default.system_net_amount;
    sql_command.Parameters.Add("@items_qty", SqlDbType.Int).Value = Properties.Settings.Default.system_item_qty;
    sql_command.Parameters.Add("@items_amount", SqlDbType.Money).Value = Properties.Settings.Default.system_item_amount;

    SqlParameter banner_file = sql_command.Parameters.Add("@banner_file", SqlDbType.VarChar);
    banner_file.Direction = ParameterDirection.Output;

    // execute the query;
    int result_rows = sql_command.ExecuteNonQuery();

    MessageBox.Show(banner_file.Value.ToString());

    sql_connection.Close();

AnswerRe: error with OUTPUT Pin
Not Active14-Oct-09 10:24
mentorNot Active14-Oct-09 10:24 
QuestionNew memory manager for db4o object database Pin
netquake14-Oct-09 3:45
netquake14-Oct-09 3:45 
AnswerRe: New memory manager for db4o object database Pin
_Damian S_14-Oct-09 15:36
professional_Damian S_14-Oct-09 15:36 
QuestionReal time data transfer Pin
krishnaveer14-Oct-09 3:04
krishnaveer14-Oct-09 3:04 
AnswerRe: Real time data transfer Pin
J4amieC14-Oct-09 3:57
J4amieC14-Oct-09 3:57 
AnswerRe: Real time data transfer Pin
i.j.russell14-Oct-09 4:38
i.j.russell14-Oct-09 4:38 
AnswerRe: Real time data transfer Pin
Ashfield14-Oct-09 21:01
Ashfield14-Oct-09 21:01 
QuestionUpdating an Access database based on a sub-select Pin
Kyle Wood13-Oct-09 9:38
Kyle Wood13-Oct-09 9:38 
AnswerRe: Updating an Access database based on a sub-select Pin
Mycroft Holmes13-Oct-09 14:36
professionalMycroft Holmes13-Oct-09 14:36 
GeneralRe: Updating an Access database based on a sub-select Pin
Kyle Wood14-Oct-09 5:03
Kyle Wood14-Oct-09 5:03 
GeneralRe: Updating an Access database based on a sub-select Pin
Kyle Wood14-Oct-09 5:26
Kyle Wood14-Oct-09 5:26 
QuestionHow to Export a SQLExpress Database Pin
BoySetsFire13-Oct-09 6:54
BoySetsFire13-Oct-09 6:54 
AnswerRe: How to Export a SQLExpress Database Pin
Not Active13-Oct-09 7:08
mentorNot Active13-Oct-09 7:08 
GeneralRe: How to Export a SQLExpress Database Pin
BoySetsFire13-Oct-09 9:46
BoySetsFire13-Oct-09 9:46 
QuestionGenerate combinations for series Pin
Member 277153113-Oct-09 4:34
Member 277153113-Oct-09 4:34 
AnswerRe: Generate combinations for series Pin
Henry Minute13-Oct-09 5:44
Henry Minute13-Oct-09 5:44 
GeneralRe: Generate combinations for series Pin
PIEBALDconsult13-Oct-09 16:02
mvePIEBALDconsult13-Oct-09 16:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.