Jump to content
Xtreme .Net Talk

soniix

Members
  • Posts

    19
  • Joined

  • Last visited

soniix's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. oh sorry hehe i dont use OleDb much,so i mistook OleDb with SQLDb sorry
  2. sorry i didnt read ur code right :) first thing is that in ur first code u only try to update the row(0) thats only a single row not the whole table second thing is, tell me what u really want to do, because as it looks to me u want to read the row with pwd xyz123 then set its login number 1 higher then write it back to the table right? but how many rows r affected by this SELECT statement only one or more? if there r more rows with that pwd then u can try this, its the simpliest way to update the table 'set the connection Dim oConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database/GMVAR.mdb") & ";") 'Your sNumber goes here Dim sNumber As Integer = 12345 'create the update command Dim cmd As New SqlCommand("UPDATE vars SET login='" & sNumber & "' WHERE pwd='xyz123'", oConnection) 'open the connection oConnection.Open() 'run the update command against the database cmd.ExecuteNonQuery() 'cloe connection oConnection.Close()
  3. at which line this error occurs?
  4. TheWizardofInt i think u should do this dim cmd as sqlcommand With ds.Rows(0) sNumber = .Item("Login").ToString lNumber = Val(sNumber) + 1 sNumber = CStr(lNumber) .Item("Login") = sNumber strSQL = "Update VARS set login ='" & sNumber & "' where pwd='xyz123'" try cmd = new sqlcommand(strsql,oconnection) cmd.executenonquery() catch ex as exception msgbox(ex.tostring) end try end with
  5. thnx for ur help,seems thats the only way to do it :)
  6. do i ever have to clear the table contents in my dataset if i do a new search? becaus if i use adap.fill(ds,"table1) it fills the table with the search results, but if i search again it doesnt empty the table1, its adding the new resulst to the end of the table, so i get more and more data in the table but not the last search results? i tried this to clear the table out ds.tables("table1").clear() is there another way to populate a datatable only with the results no more no less?
  7. no, all 4 textboxes get bound after i click on the grid, but its good to know that i have to clear the bindings whenever i click on the grid
  8. me again :) ok i´ll explain first :) the scenario i have a form with 4 textboxes and a datagrid if i type something in the 1st textbox it searches my database for this criteria, and then fills the results in the datagrid now then i click on a row in the datagrid, i want the textboxes to get bound to the database, works all fine :) but if i click on another row the databindings still exist on the textboxes and i get an error with double databindings so now my question, do i always have to clear the bindings and add em again if i click on the datagrid? i created the dataset and the dataadapter at runtime
  9. thnx for help, i got it now, and apaule ur right i looked at the northwind db and there i saw that all chat fields r nvarchar i changed this in my db and all worked fine but my compare works becaus if i type in "admin" as username and not "ADMIN" it gives me an error
  10. i know this way but its to complicated there must b a shorter way too because most of the data in my tables have empty spaces because of the length of the fields
  11. i have a problem with the length of fields in a sql data table let me say i have 3 fields in this table username, userpass and userid all with the length of 10 bytes on a form i have 2 textboxes for the username and the userpass i want to compare if the username and the userpass matches the values in the database. i do this with a datareader code below mainconn.Open() sel = New SqlCommand("SELECT * FROM users WHERE username='" & username & "'", mainconn) Dim userread As SqlDataReader = sel.ExecuteReader() userread.Read() If userread.Item("Username") = username And userread.Item("Userpass") = password Then userid = userread.Item("userid") loggedin = True username = username Else loggedin = False End If useradap.Close() Return loggedin in the databes there is one record stored userid = 1 username = ADMIN and userpass = admin but if i try to compare these two values with the values the user entered i always get loggedin to false because of the length of the values. the length in the textboxes if i type in ADMIN is 5 and the length in the database for ADMIN is 10 so how can i compare these values without the left spaces in the database?
  12. ive got a question, if i creat a dataset and a datatable at runtime that means it doesnt comes from the server how do i write its data to a table in the database? is it possible with a for each loop?
  13. no, the value of the data is 1, anyways i can bind the text property to the same data and all works, the error occurs only when i bind the tag property of the text box i forgot, i can bind the tag property the error occours then only if i navigate trough the grid up and down, so the tag properties changes every time
  14. i got a quick question, is there a chance to put controls on a MDIParent let me say a grid or something without the MDIChilds lyin under that control if they arr shown?
  15. hmmm, if u use the built in datagrid i get this error http://www.designstudien.de/error.jpg
×
×
  • Create New...