Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

add new row to my database with vb

5 views
Skip to first unread message

F.N.Z

unread,
Jul 17, 2008, 1:51:01 AM7/17/08
to
I have a project in vb.net 2005 and it works with a database in SQL server.
my forms and controls binding with my database without any problems, but
adding a new row is my nightmare. I add a new row to my database and it shown
in a data grid that I prepared for that database, but the problem is, when I
stopped the project and run it again, I lose the new row, I just have those
rows that I add it manually in the database, and it seems that the new row
hadn't been insert in my database. I used a lot of different codes to add a
new row to my db, but none of them has worked.I have to mention that my OS is
vista, and I think maybe this problem won't occurred in other OS.another
point is, I didn't create the db in SQL, I created it in vb.net itself and
filled it.please help me!
the following codes are the codes that I wrote to add a new row, I examine
them one by one separately,but no result:

'Dim newrow As studentDataSet.mystudentRow =
Me.StudentDataSet.mystudent.NewRow
'newrow.id = IdLabel1.Text
'newrow.name = NameTextBox.Text
'Me.StudentDataSet.mystudent.Rows.Add(newrow)
'MystudentBindingSource.AddNew()
'NameTextBox.Focus()
'MystudentBindingSource.AddNew()
'Me.StudentDataSet.mystudent.NewRow()
'MystudentBindingSource.Current("name") = txtname.Text
'MystudentBindingSource.Current("family") = txtfamily.Text
'MystudentBindingSource.Current("tel") = txttel.Text
'MystudentBindingSource.Current("address") = txtaddress.Text
'MystudentBindingSource.EndEdit()
'Me.MystudentTableAdapter.Update(StudentDataSet)
'Me.Validate()
'Me.MystudentTableAdapter.GetData.AddmystudentRow(NameTextBox.Text,
FamilyTextBox.Text, TelTextBox.Text, AddressTextBox.Text)
'Me.MystudentTableAdapter.Insert(NameTextBox.Text,
FamilyTextBox.Text, TelTextBox.Text, AddressTextBox.Text)
'Me.MystudentTableAdapter.Update(NameTextBox.Text,
FamilyTextBox.Text, TelTextBox.Text, AddressTextBox.Text, 1, "Fatemeh",
"Nemati", "0913")
'Me.MystudentBindingSource.EndEdit()
'Me.MystudentTableAdapter.Update(Me.StudentDataSet.mystudent)
' MystudentBindingSource.MoveFirst()
'Dim newrow As studentDataSet.mystudentRow =
Me.StudentDataSet.mystudent.NewRow
'newrow.id = 4
'newrow.name = "Ernest"
'newrow.family = "Watsone"
'newrow.tel = "0131"
'newrow.address = "U.S."
'Me.StudentDataSet.mystudent.Rows.Add(newrow)

@discussions.microsoft.com Andraž

unread,
Nov 19, 2008, 3:59:02 PM11/19/08
to
data says only in build applications. It is my experince but in c#.

could i use only in VC#.

0 new messages