|
-
Aug 3rd, 2004, 08:06 AM
#1
Thread Starter
Lively Member
dataopen in vb.net
hi u all
i just enterd the world of .net and i want to
1. connect to database
2. select the value in the table
3. goto to the last value that is a numeric
4. add to him +1
5.insert him to the table
and i feel i am going round and round but not to the point
my code is
Sub main()
Dim sqlsel As String
Dim sqlcom As String
Dim Sconnetcion As String
sqlsel = "provider=SQLOLEDB.1;PASSWORD=xxx;USER
Security=SSPI;database=database;server=server"
Dim objse As New Data.SqlClient.SqlConnection(sqlsel)
sqlcom = "select num_mad from rashut"
Dim objdataAdaptor As New _ system.Data.SqlClient.SqlDataAdapter(sqlcom, objse)
Dim objle As New Data.DataSet("madnu")
objse.Open()
Try
objdataAdaptor.Fill(objle, "madbeka")
Dim objtable As Data.DataTable
objtable = objle.Tables("madbeka")
Dim drrows As Data.DataRowCollection
Dim objrow As Data.DataRow
drrows = objtable.Rows
Dim num As Integer
num = objtable.Rows.Count
Dim selnum As Integer
selnum = "select num_mad from mad_sh2 where id=" + num
Dim cmsql As New System.Data.SqlClient.SqlCommand
Dim drsql As System.Data.SqlClient.SqlDataReader
drsql = cmsql.ExecuteReader(selnum)
Dim inc As Integer
i feel i writing evrything that can write in data
please help to do that simple thing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|