Hello,
I am working on a C# application where i have to store values of article in sql server as i have 3 products (stone, diamonds, jewellery). Now during the initial process when i enter the product details let say i have to store value for a diamonds i put in the required details, now i want that in the database a sno value should be stored as a increment counter(D001) next time when i enter details for diamond the sno should be automatically stored as 002. Same is the case with stone , jewellery.
Diamonds: D001, D003, D003.....
Jewellery : J001, J002, J003.....
Stone: S001, S002, S003.....these all should be stored as sno in same database table. is it possible. Please help me through. waiting for are reply.Thanks in anticipation
Loading
SenthilkumarPosted Apr 5, 2012, 6:52 AM
you can use the stored procedure to insert these things into the table.
Whatever i said in the previous reply follow the same. Because it must need some kind of logic to generate the alphanumeric auto increment for type wise.
Writing the stored procedure is not a big deal, just you need to pass the input parameter from the code.
Hope this will help you.
M MPosted Apr 5, 2012, 6:13 AM
string qry = "insert into GemStone (Receipt,DTPbDay,ItemType,Weight,Client,Address,Contact,Amount,OriginalPath,ImageData) values(@Receipt,@DTPbDay,@ItemType,@Weight,@Client,@Address,@Contact,@Amount,@OriginalPath, @ImageData)"; whr ItemType is the type of article(S,D,J)
now the thing is i want to add these details + individual value for artcle type(like D001, D001) for each article on daily basis. if details of diamond is added with this statement above wht should i add to acheive serial number for each item type. Bit confusing....
brunda kPosted Apr 4, 2012, 11:32 AM
http://technet.microsoft.com/en-us/magazine/hh407114.aspx
SenthilkumarPosted Apr 4, 2012, 10:23 AM
I do not think you have any straight forward way to do this.
You need to have table some thing like this.
Whenever you insert then you need to follow this logic.
Posted Apr 4, 2012, 8:32 AM