S
sun919
hi there,
I have problem regarding insert data into empty table. i have two fields
which is religionID and ReligionName
i have try to insert data that generate use @@identity inorder to find and
create id no. and it still doesnt work and i have try to do insert and update
into table and still nothing is adding to the table. I m using sql server for
the database this is what my insert and update into table look like
Dim catDA As SqlDataAdapter = New SqlDataAdapter("SELECT ReligionID,
ReligionName FROM ReligionType", con2)
catDA.InsertCommand = New SqlCommand("InsertReligion", con2)
catDA.InsertCommand.CommandType = CommandType.StoredProcedure
catDA.InsertCommand.Parameters.Add("@ReligionName", SqlDbType.
NVarChar, 20, "ReligionName")
Dim myParm As SqlParameter = catDA.InsertCommand.Parameters.Add
("@Identity", SqlDbType.Int, 0, "ReligionID")
myParm.Direction = ParameterDirection.Output
Dim catDS As DataSet = New DataSet
catDS.Locale = New System.Globalization.CultureInfo("th-TH")
con2.Open()
catDA.Fill(catDS, "ReligionType")
Dim newRow As DataRow = catDS.Tables("ReligionType").NewRow()
newRow("ReligionName") = inputdata.Text
catDS.Tables("Religion").Rows.Add(newRow)
catDA.Update(catDS, "ReligionType")
con2.Close()
I have problem regarding insert data into empty table. i have two fields
which is religionID and ReligionName
i have try to insert data that generate use @@identity inorder to find and
create id no. and it still doesnt work and i have try to do insert and update
into table and still nothing is adding to the table. I m using sql server for
the database this is what my insert and update into table look like
Dim catDA As SqlDataAdapter = New SqlDataAdapter("SELECT ReligionID,
ReligionName FROM ReligionType", con2)
catDA.InsertCommand = New SqlCommand("InsertReligion", con2)
catDA.InsertCommand.CommandType = CommandType.StoredProcedure
catDA.InsertCommand.Parameters.Add("@ReligionName", SqlDbType.
NVarChar, 20, "ReligionName")
Dim myParm As SqlParameter = catDA.InsertCommand.Parameters.Add
("@Identity", SqlDbType.Int, 0, "ReligionID")
myParm.Direction = ParameterDirection.Output
Dim catDS As DataSet = New DataSet
catDS.Locale = New System.Globalization.CultureInfo("th-TH")
con2.Open()
catDA.Fill(catDS, "ReligionType")
Dim newRow As DataRow = catDS.Tables("ReligionType").NewRow()
newRow("ReligionName") = inputdata.Text
catDS.Tables("Religion").Rows.Add(newRow)
catDA.Update(catDS, "ReligionType")
con2.Close()