Table name is Chatting. stored procedure name is chat. problem is i cn see confirmation msg tht the message has been sent but i cnt see that data into the table. what am i doing wrong.
/*** table chatting
USE [Event]
GO
/****** Object: Table [dbo].[Chatting] Script Date: 04/03/2013 23:53:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Chatting](
[vSender] [varchar](30) NOT NULL,
[vReceiver] [varchar](30) NOT NULL,
[Message] [varchar](200) NULL,
[vDate] [datetime] NOT NULL
) ON [PRIMARY]
*/stored procedure name is 'chat' */
USE [Event]
GO
create procedure [dbo].[chat]
(
@vSender [varchar](30),
@vReceiver [varchar](30),
@Message [varchar](200),
@vDate [datetime]
)
as
insert into dbo.Chatting values(@vSender,@vReceiver,@Message,@vDate)
*/ c# code on Send_click_button is /*
string ConnectionString = "Data Source=GHOST-PC\\SQLEXPRESS;Initial Catalog=Event;Integrated Security=True";
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand("chat", con);
con.Open();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@vSender",DataContainer.v3.ToString());
cmd.Parameters.AddWithValue("@vReceiver",comboBox2.DisplayMember);
cmd.Parameters.AddWithValue("@Message",textBox1.Text);
cmd.Parameters.AddWithValue("vDate", dateTimePicker1.Text);
MessageBox.Show("Message Sent");
{
textBox1.Text = "";
}
con.close();