Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert correct with no problem but data is not added to sql database

Status
Not open for further replies.

sup919

Programmer
Jan 10, 2002
31
TH
hi there
got a question regarding sqlserver ,
well i m currently writing a program in vb.net and when i have run debug i manage to added the data but in reality it did not added to database in sqlserver ... i m currently using nt integrated security log on ... when i execute store procedure in server explorer alone, the data added to database but when writing a vb it doesnt dont know why ? this is my code for the program

Readap.InsertCommand.CommandType = CommandType.StoredProcedure

Readap.InsertCommand.Parameters.Add("@ReligionName", SqlDbType.NVarChar, 20, "ReligionName")


Dim myParm As SqlParameter = Readap.InsertCommand.Parameters.Add("@Identity", SqlDbType.Int, 4, "ReligionID")

''set to out put
myParm.Direction = ParameterDirection.Output

'TextBox1.Text = myParm.Value
Dim catDS As DataSet = New DataSet
catDS.Locale = New System.Globalization.CultureInfo("th-TH")

con2.Open()


Readap.Fill(catDS, "ReligionType")

Dim newRow As DataRow = catDS.Tables("ReligionType").NewRow()
newRow("ReligionName") = inputdata.Text
'newRow("ReligionID") = 1

'add new stuff
catDS.Tables("ReligionType").Rows.Add(newRow)
catDS.AcceptChanges()


Readap.Update(catDS, "ReligionType")

con2.Close()

please someone have a look and tell me what is the cause of this

many thanks
sun
 
You probably should post this in a VB.NET forum.

I don't see where you are assigning a value to the parameter you created. I also don't see where you are calling the SP to Insert your data.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top