-
Posts
29 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by hemenkap
-
getprivateprofilestring API Help needed
hemenkap replied to hemenkap's topic in Interoperation / Office Integration
hi dyanmic_sysop, thanks a lot for the much needed help. Hemen Kapadia -
help with dataset current position....
hemenkap replied to hemenkap's topic in Database / XML / Reporting
hi friends, finally after about 2 months this problem is solved. you can do the following as i do it. the commandtext of my select command looks like this. SELECT * FROM TABLE ORDER BY COLUMN_YOU_WANT_TO_SEARCH_ON the column on which i order is the customer code ( for example) which i have ket unique and is indexed as i dont want to repeat codes the primary key is and integer column hidden from the user of the system. now once you have filled a table in the dataset you have to create a dataview from this table using the ORDER BY column to sort it. The dataview.Find method returns an index ( long ) of the position of the current datarow in the sorted dataset rather than the actual datarow as returned by most other find methods. this is the only way i could do it. if anybody knows any better way do let me know. i dont remember the actual dataview code. it is very small about 3 to 4 lines you can see it in MSDN Hemen Kapadia -
emulate recordset.find method for dataset.
hemenkap replied to hemenkap's topic in Database / XML / Reporting
Hi, Thanks for you advice. i tried it out today and it worked. Hemen Kapadia -
weird app runs fine on win 2000 but not on 98
hemenkap replied to hemenkap's topic in Database / XML / Reporting
hi, i am using the dataadapters update method to update the data written in the tables stored in the dataset. also i am using transactions to do so. one important thing is that the code works fine in Windows XP and Windows server 2000 with both access and MS sql server 2000 however when i tried it in win 98 using MSDE it works fine but the same code gives this concurrency erro with access in 98. god knows why? i tried to figure it out but in wain.please help.... -
weird app runs fine on win 2000 but not on 98
hemenkap replied to hemenkap's topic in Database / XML / Reporting
hi robby, no i hacve taken care of this too. i have made sure that whenever i open a connection i do close it. my problem is that it inserts rows fine but when you update an existing row it gives error. i will try to create a sample project and paste the code in the meantime if you have any ideas as to wh this is happenning do reply. Hemen Kapadia -
Working With Null Values from the DB
hemenkap replied to MarkItZero's topic in Database / XML / Reporting
hi friends, would like your comments on this one txtLocation.Text = Trim(Cstr(IIF(IsDBNull(RcrdSt("Location"))," ",RcrdSt("Location")))) please match the brackets as i am finding it difficult to do so without the .NET ide. bye -
i want to emulate the recordset.find method for the dataset. my main concern is that recordset.find method returns the position ( or rather it moves to cursor to the record that fulfills the criteria) and the we can get the position using the absloute position property. i want to do the same thing for dataset. i dont want the function to return the matching datarow, i want it to return the position of the matching datarow in the dataset. Thanks
-
hi, i have created an application in VB.NET using Access XP as the backend ( actually i use it with SQLserver also ) all i do is change the connection string of the oledbconnection. now i have teste my application on XP as well as Windows 2000 but when i try to use it on 98 it works fine by retriving the data. when i try to insert a record it inserts it also. however when i try to update a record it gives me a concurrency error even when i am the only person using the application and even when access database is closed. help please.
-
Working With Null Values from the DB
hemenkap replied to MarkItZero's topic in Database / XML / Reporting
hi markitzero the error "Cast from type 'DBNull' to type 'String' is not valid" is raised by Cstr and even in the iif ststement that u have youes you have still made the same mistake. it will still give the same error as you are still trying to convert a null value to string. you can try as nersus said or if you still want to stick to iff then do it this way txtLocation.Text = IIF(IsDBNull(RcrdSt("Location"),"",RcrdSt("Location").ToString()) -
hi , just as jfackler said you nedd to use a dataadapter and a dataset for this. say you fill the dataset using the dataadapter and call you table as Table1 then you can get the recordcount as Dataset.Tables("Table1").Rows.Count bye.
-
How should i update the database??
hemenkap replied to godkevin's topic in Database / XML / Reporting
hi, i think you are not calling Dataset.Update to reflect the in memory changes back to the database. might be that is the reason your database is not geting updated. try checking if the changes you make in the memory are actually happenning using breakpoint in the code. if they are then you need to reflect then back to the database using Dataset.Update -
help with dataset current position....
hemenkap replied to hemenkap's topic in Database / XML / Reporting
thanks, but dr.Item("IDRow") will return the data stored in the colum called idRow in the database. it dont want that . it want the position of the datarow in the dataset. what i need is this, i am explaining it in terms of recordset. as it might make things clear. when we do recordset.Find ( SOME CRITERIA ) the the recordset is searched for all rows and it stops at the row which satisfies our condition. moves to current row pointer to that row. now since in a dataset there is nothing like the current row pointer ( this is the reason we do not have anything like Move last, move first etc...) . i treied a lot will try this too. if it works i will let you know bye, hemen Kapadia -
look yaniv, what you gain in this new way will occur to you as you prac tice furthur. just want to explain to you where you were going wrong. look the dataAdapter has 4 commands associated with it. one for each of the following actions. Select, Update, Insert & Delete. each of this is a seperate property of the dataadapter. you were setting the query for the select command only. so how will the data adapter know what is the delete.update/insert query unless and untill you set that query using updatecmd.commandtext = " SQL update stmt" dataadapter.updatecommand = updatecmd so now the dataadapter know how to update it. to save you the hassel of writing the update/insert/delete commands we have something called command builder which is excplained by sizer what it does is that i creates the sql query for each of the 3 actions. NOTE : you have to first give the select command and sql select stmt for the command builder to work else it wont work. Hemen
-
you can even youe something like this st = conn.CreateCommand st.CommandText = "Sql Select Statement" Ada.SelectCommand = st ada.fill( ds , "Table Name") ' if you want to update /insert/delete in the same table then add Dim cb as oledb.Commandbuilder = new _ oledb.Commandbuilderada) however check the commandbuilder sysntax. i mya hav made some error. not sure..
-
hi, this error Update requires a valid UpdateCommand when passed DataRow collection with modified rows is flasehd when you are trying to insert /update/delete a record in a dataset and you have not set the appropricate commands for the dataadpater used for filling the table. i suggest sfter you set the select command for the dataadapter you use a command builder boject to fill all the remaining commands for insert/update/delete. then it will work fine. Hemen Kapadia
-
Example of accessing ADO.Net
hemenkap replied to TheWizardofInt's topic in Database / XML / Reporting
hi possiblydamp, just a little bit confused as to checking the connection state using the code dim conn as System.Data.SqlClient.SQLConnection if conn.State = ConnectionState.Closed 'Connection closed end if -------------------------------------------------------------------------------- as you stated above. i think this will check the connection state. how exactly can i do it for a datset? like we do for recordset. is there any method. also while searching in recordset using find command we can know the cursor position in the recordset. in dataset.table.Select we can search the fields but can we get the location where the search stopped ? help. -
hi , i think you must be having the ODBC drivers for the database you are using. you can find it out by going to control panel " ODBC datasources" here you will have the list of available drivers to choose from and i think you can locate that at least. Then using that driver areate a user/system DSN and use that dsn name simply as a connection string. it will work. however Odbc Class librayr is not shipped with VS .NEt and you need to download it frm the net. just search for "ODBC Drivers for .NET" at google and you will be abel to locate it. rest all is same as for sql/olebd with some minor differences here and there.
-
but i have a doubt bot codes look the same excet that below we are handling an exception. however handling exceptions is a good practice, it is not absolutely necessary so i want to know where exactly was athe fault above. please guide me. Hemen
-
well , i dont know exactly why you need 1000 rows with the id fierlds filled but data absent. i think you are using the id firled as a primary key or not the at least unique as there is no point having 2 students with the same id. if you have problem tracking what is the id of the last inserted student than you can let access manage it by using autoincrement as robby pointed out. Else you can have another table in the same database that has one row only and it stores the last inserted number. Every time you insert a record you incrementy this number before the actual insertion. in this way even if the number is updated but entry fails then too you will have unique ids. although there is a chance that u may some nos in between
-
you can do the following 1. ) creat a oledbConnection 2. ) Open that connection. 3. ) Create an OledbCommand Object 4.) Creat a OleadDataAdapter 5. ) Create a Dataset then do as follows : OledbCommand = OledbConnection.CreateCommand OledbCommand.CommandText = " Select ......." OledbDataAdapter.SelectCommand = OledbCommand DledbDataAdapter.Fill(Dataset,"TableName") Over That will fill the dataset with data
-
How to avoid duplicate ID When data entry ?
hemenkap replied to desmondtan's topic in Database / XML / Reporting
ok suppose you dont want two ppl to have the same code name then what you can do is this dim adr() as DataRow = Dataset.Tables("TableName").Select("EmpCode = '" & CODE & "'") if adr.length = 0 Then ' the code to allow him to enter the value in db Else ' sorry buddy value exists End if -
well, as far as using the same data adapter is concerned to fill two different tables i dont fell it is possible. i use different adapters too as it is more clear to code. also one important thing is that suppose if you are using the command builder object to build the insert/update/delete commands for a table in the dataset it requires to have 2 different adapters. however you can populate a single dataset with any number of tables but you must use individual dataadapters for filling the same dataset with each different table.
-
help with dataset current position....
hemenkap replied to hemenkap's topic in Database / XML / Reporting
Hi Nerseus, thanks for replying. i tried it out. but did not help.... can you think of any other way..... Hemen -
help with dataset current position....
hemenkap replied to hemenkap's topic in Database / XML / Reporting
ok thanks, i dont think looping is a good option as there could be more than 5000 records and looping is tedious. i will try the dataviews find method and see if this works. will surely tell if it worked or now. thanks once againg for help... Hemen Kapadia