mehrdad_rabbi
شنبه 14 شهریور 1388, 14:08 عصر
بنده قصد اينزرت در فرم را دارم لطفا راهنمايي فرماييد
كدم:
try
{
sqlConnection1.Open();
sqlCommand1.Parameters.AddWithValue("@name", textBox11.Text);
sqlCommand1.Parameters.AddWithValue("@family", textBox2.Text);
sqlCommand1.Parameters.AddWithValue("@photo",textBox6.Text);
sqlCommand1.Parameters.AddWithValue("@age", textBox7.Text );
sqlCommand1.Parameters.AddWithValue("@carcod",comboBox1.SelectedValue);
sqlCommand1.Parameters.AddWithValue("@carburn", textBox10.Text);
sqlCommand1.Parameters.AddWithValue("@cmelli", textBox1.Text);
sqlCommand1.Parameters.AddWithValue("@mobilenum",textBox3.Text);
sqlCommand1.Parameters.AddWithValue("@phonenum",textBox4.Text);
sqlCommand1.Parameters.AddWithValue("@tahsilat", textBox5.Text);
sqlCommand1.Parameters.AddWithValue("@adress",textBox9.Text);
sqlCommand1.Parameters.AddWithValue("@no", int.Parse(noTextBox.Text));
sqlCommand1.ExecuteNonQuery();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
sqlConnection1.Close();
}
واین خود رویه :
ALTER PROCEDURE [dbo].[drivers]
@no int,
@name nvarchar(50),
@family nvarchar(50),
@photo nvarchar(max),
@age nvarchar(50),
@cmelli nvarchar(50),
@carcode int,
@carburn nvarchar(50),
@mobilenum nvarchar(50),
@phonenum nvarchar(50),
@tahsilat nvarchar(50),
@adress nvarchar(max)
AS
if not Exists(Select * From driver where no=@no)
begin
Insert into driver ([name],family,photo,age,codemelli,carcode,CarBurnYear,Mo bilenumber,PhoneNumber,Tahsilat,Adress)
values
(@name,@family ,@photo,@age ,@cmelli ,@carcode ,@carburn ,@mobilenum ,@phonenum ,@tahsilat ,@adress)
end
پس از كليك در باتن مربوطه براي اينزرت اين پيام مياد:
PROCEDURE OR FUNCTION DRIVERS HAS TOO MANY ARGUMENTS SPECIFIED
كدم:
try
{
sqlConnection1.Open();
sqlCommand1.Parameters.AddWithValue("@name", textBox11.Text);
sqlCommand1.Parameters.AddWithValue("@family", textBox2.Text);
sqlCommand1.Parameters.AddWithValue("@photo",textBox6.Text);
sqlCommand1.Parameters.AddWithValue("@age", textBox7.Text );
sqlCommand1.Parameters.AddWithValue("@carcod",comboBox1.SelectedValue);
sqlCommand1.Parameters.AddWithValue("@carburn", textBox10.Text);
sqlCommand1.Parameters.AddWithValue("@cmelli", textBox1.Text);
sqlCommand1.Parameters.AddWithValue("@mobilenum",textBox3.Text);
sqlCommand1.Parameters.AddWithValue("@phonenum",textBox4.Text);
sqlCommand1.Parameters.AddWithValue("@tahsilat", textBox5.Text);
sqlCommand1.Parameters.AddWithValue("@adress",textBox9.Text);
sqlCommand1.Parameters.AddWithValue("@no", int.Parse(noTextBox.Text));
sqlCommand1.ExecuteNonQuery();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
sqlConnection1.Close();
}
واین خود رویه :
ALTER PROCEDURE [dbo].[drivers]
@no int,
@name nvarchar(50),
@family nvarchar(50),
@photo nvarchar(max),
@age nvarchar(50),
@cmelli nvarchar(50),
@carcode int,
@carburn nvarchar(50),
@mobilenum nvarchar(50),
@phonenum nvarchar(50),
@tahsilat nvarchar(50),
@adress nvarchar(max)
AS
if not Exists(Select * From driver where no=@no)
begin
Insert into driver ([name],family,photo,age,codemelli,carcode,CarBurnYear,Mo bilenumber,PhoneNumber,Tahsilat,Adress)
values
(@name,@family ,@photo,@age ,@cmelli ,@carcode ,@carburn ,@mobilenum ,@phonenum ,@tahsilat ,@adress)
end
پس از كليك در باتن مربوطه براي اينزرت اين پيام مياد:
PROCEDURE OR FUNCTION DRIVERS HAS TOO MANY ARGUMENTS SPECIFIED