
soniix
Members-
Posts
19 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by soniix
-
oh sorry hehe i dont use OleDb much,so i mistook OleDb with SQLDb sorry
-
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()
-
at which line this error occurs?
-
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
-
thnx for ur help,seems thats the only way to do it :)
-
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?
-
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
-
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
-
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
-
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
-
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?
-
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?
-
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
-
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?
-
hmmm, if u use the built in datagrid i get this error http://www.designstudien.de/error.jpg
-
hehe i know the line of code its the line where i bind the tag property from a textbox to data as long as i bind the text property to data it all works fine i can navigate in the grid up and down this error occurs only if i bind a tag property to any of the textboxes :confused: ok heres the working example stlaenge.DataBindings.Clear() stlaenge.DataBindings.Add("Text", datasource, "StammTeilLaenge") stdim.DataBindings.Clear() stdim.DataBindings.Add("Text", datasource, "StammDimension") stwst.DataBindings.Clear() stwst.DataBindings.Add("Text", datasource, "StammWerkstoff") and here is the not working example stlaenge.DataBindings.Clear() stlaenge.DataBindings.Add("Tag", datasource, "StammTeilLaenge") stdim.DataBindings.Clear() stdim.DataBindings.Add("Text", datasource, "StammDimension") stwst.DataBindings.Clear() stwst.DataBindings.Add("Text", datasource, "StammWerkstoff")
-
hi there i got another problem :( let me explain i have a search form with some text boxes and a datagrid. ok if i type some string into one textbox and then press F2 it searches in the databes for the string and then commit the result back and i load the results into the datagrid so far so good :) if i click on a grid row it first clears the databindings from all textboxes and then binds the textboxes again to the data (most of em are text databindings) then i can click around the grid and get the actual data to the textboxes BUT if i bind the Tag property of a textbox to some data like an ID and then click around i get an error like this An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll and then the program halts at the class definition of the main form :( (Public class form2) how can i fix this? i also noticed that if i bind data to the text property of a textbox and if i type this textbox1.databindings.add("text",datasource,"ID") then this error occurs too if i change text to Text the error wont occur
-
ok i´ll try this new dataset thing i hope it will help and after that i can kill the dataset if its unused thnx
-
i have a small question how can i write only one table from a dataset to an xml file and not the whole dataset, if the dataset contains more than one tables? thnx