|
Hi,
i have a master Table "order" Primary key is Order_id at the same time i have another table "Order_Detail" now the problem is i wnt to insert the Order_id at the "Order_Detail Table" five time or more or lesss at the same time whn the order is insert in the Order table,how can i ?
if the the Order_id is inserted in the "Order" table and fail to insert the Order_Detail Table ,then i wnt to rollback the Order_id in Primary table,and many users are placing order at the same time ..tell me how can i manage this?
this is my desktop application...
Send me some stored Procedur or tell me some other way of hanlding this....?
Waiting for ur response.
Best Regardsx
|
|
|
|
|
Try the following code with some modifications.
Dim connectionString As String = _
"Data Source=data source;Initial Catalog=your database;Integrated " + _
"Security=True"
Dim trans As SqlTransaction = Nothing
Dim connection As SqlConnection = _
New SqlConnection(connectionString)
connection.Open()
Try
trans = connection.BeginTransaction
Dim command As SqlCommand =
command = New SqlCommand(yourSQL, connection, trans)
command.ExecuteNonQuery()
' add your loop to the following 2 lines
' Put the sql that will update the order details table here
command = New SqlCommand(yourSQL, connection, trans)
command.ExecuteNonQuery()
trans.Commit()
Signature has been encrypted
|
|
|
|
|
exactly the same i tried bt between this loop or above the loop i open another connection this connection get the max(Order_Detail_id) not used the trans and give Exception bcz the connection is already associated with transaction and i made another object with out transaction in bwteent he transaction processing how cani manager this.???Send me some codesnippet that handle this sort of scenario...
waiting ....
|
|
|
|
|
do not open another connection, you can use the same connection
put this code before the for loop
Dim dr as SqlDataReader
command = New SqlCommand(yourSQL, connection, trans)
dr=command.ExecuteReader()
then read the value from the datareader
best regards,
wachill
Signature has been encrypted
|
|
|
|
|
Thnks
i try and vll let u knw ,,
|
|
|
|
|
Hi to All,
Query Regrading : get the position of runtime for 'n' controls
I had created the runtime control of checkbox with the database field...
It displays the 'n' nuber of controls...
My exact need is,i want to place the control in a particluar position of each and every conrol.
For Example:Design View (need)
1 2
3 4
5 6
karthi
|
|
|
|
|
I am not sure that I understood your question ? You want to add some controls dynamically to specified position on the form . So try to use contentplaceholder. You can add controld to this holder. Place the control where u wan to show them
|
|
|
|
|
Hi Dear ,
I guess you created controls checkbox runtime , and added controls like
[Parent].controls.add() and then allocate location property as point on parent control of checkbox [here maybe Form]
Develop2Program & Program2Develop
|
|
|
|
|
hi,
I have my vb.net class library. now I want to use two c# class files in my vb.net class library. So how to do that?
I want to use c# class's methods in my vb.net class.
Please advice.
Thanks,
Sun Rays
|
|
|
|
|
|
You cannot have classes written in different languages compiled into the same assembly.
What you will have to do is add a Second project to your solution (a c# class library project) Add the c# classes to the c# project. Now add a project reference from your vb project, to the c# project.
Like this you can access the c# classes from the vb project, and step through into them when debugging.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
|
|
|
|
|
Post the two classes here and I'll convert them for you.
(or email me at the info email related to the url in my signature).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
Hi ,
I 'am working on an application to store information of daily letters coming into my office. I want to keep scanned copy of the original( in pdf format only ) and have access on them within my program. Right now , I have to manually scan the letters ( after storing other information in db ) using adobe acrobat. ( adobe acrobat has a button 'Create PDF >> from Scanner ) . is there any way that i can do something like that in my application. OR , Is there anyway that I can Call adobe to do what I am doing now, without manually scanning and giving them filename , Path etc. ??
Any help will be appreciated. THANK YOU.
|
|
|
|
|
This, this and, especially, this (follow the links) may help.
Best regards,
Dmitry.
P.S. One more thing.
P.P.S. Do a Google search for "VB.net scanning". It'll give you a plethora of links
-------------------------
Don't worry, be happy )
|
|
|
|
|
Hi
thank you for Your help.
I managed to do the scanning part.
but I want the scanned image to be saved as a .pdf file. ( sometimes its multiple page file) . how can i do that?
thank you.
|
|
|
|
|
Hi i have 2 drop downlist box,
in that one i can select year another one month,
if i select the month,that month all dates want to be display in datagrid,
how to do that
Regards,
Magi
|
|
|
|
|
Magh_M wrote: if i select the month,that month all dates want to be display in datagrid,
Using DateTime.DaysInMonth(year,month) you can get the no of days in that month. Put that in a loop and add all to the date dropdown list.
|
|
|
|
|
hi frnds,
i need to implement spell check functionality in windows form for dis
i'm using rich text box as an editor and all functionality of word
bt not able to use spell check.
so if any 1 knows abt spell check coding for win forms plzzz help me
thnxs
|
|
|
|
|
|
I need help to create a scrabble game. can anyone please help me to create scrabble game. i have to do using visual basic language. if there is anyone plase help me............ thats what i have so far but i have to write alot of if statements inorder to specify location.
Public squares(15, 15) As Square
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim k As Integer
Dim irow, jcolumn As Integer
Dim squarevalue As String
Dim mysquare As Square
' Dim box As Integer
Dim i, j As Integer
For irow = 1 To 15
For jcolumn = 1 To 15
mysquare = New Square(irow * 40, jcolumn * 40)
mysquare.SizeMode = PictureBoxSizeMode.StretchImage
mysquare.Name = (irow & jcolumn)
For j = 1 To 15
If irow = 12 And jcolumn = 12 Then
mysquare.Image = Image.FromFile(Application.StartupPath & "\scrabbleboard\TripleWord.jpg")
End If
Next
If irow = 8 And jcolumn = 8 Then
squarevalue = "Star"
mysquare.Image = Image.FromFile(Application.StartupPath & "\scrabbleboard\STAR.jpg")
Else
squarevalue = "BLANK"
End If
mysquare.value = squarevalue
squares(irow, jcolumn) = mysquare
Me.Controls.Add(mysquare)
Next jcolumn
Next irow
End Sub
Public Class Square
Inherits PictureBox
Public value As String
Public Sub New(ByVal x As Integer, ByVal y As Integer)
MyBase.New()
Me.SetBounds(x, y, 40, 40)
If value = "DL" Then
BackColor = Color.AliceBlue
ElseIf value = "star" Then
BackColor = Color.White
ElseIf value = "TW" Then
BackColor = Color.Red
Else
value = "Blank"
BorderStyle = Windows.Forms.BorderStyle.Fixed3D
BackColor = Color.Tan
End If
End Sub
End Class
End Class
|
|
|
|
|
What do you need help with specifically? Having tackled scrabble a while back I know most of what it takes to create the game. However, it's not really easy to say "just do this". What I ended up with wasn't so much a game as a board analyzer. It could look at the board and figure out the top 40 moves it could make using the tiles it was given.
I think your best bet is to look for examples online. I found some, but unfortunatlly I don't have the links anymore. I don't think I ever found an example in vb.net. The closest I could find was C#.
Is this game supposed to be Human vs. Human, Human vs. Computer, or both? This will definitly change what you'll need to code. The first thing you'll need is a dictionary. Even if it's human vs human your going to have to verify words. The site I got my dictionary from doesn't seem to have it anymore. However, I've still got the text file with all the acceptable words for tournaments. I think the list is from 2005. A little old but probably good enough. If you need it I'll get it to you.
Other than that I don't know what else to say. I think classes will be your friend. Try to break the game up into logical parts. For instance I had a tile class that represented individual tiles, a bag class which held the tiles, and a board class which represented the board. I think I even had a rack class to hold the tiles for the players. Definitly make good use of classes. If have specific questions feel free to ask. Hopefully I can help or someone else on here knows something or could point you to helpfull sites. Unfortunatly all my links from my research are gone.
|
|
|
|
|
By tile are you refering to wheather or not its a double, triple word etc. If you look at it on a row by row basis it makes things easier. Using Select case statments within a loop will be the easiest. Also try to figure out where you can take shortcuts. For instance a double word appears in a step pattern. In row 1 it appears in the first and last column. In row 2 it appears in the 2nd and second to last column. So, to determine where the double should be for a particular row you could use (Row,Row) and (Row,16-Row) where the first value is your row and the second value is your column. Using a select case statment you can easily exclude the few rows that don't have double words. To try to clarify my point I'll show you a snippet of code I used. I hope the concept will be clear.
'//Loop through each row
For i As Integer = 1 To 15
'
Select Case i
Case 1 To 5, 8, 11 To 15
'//Place doubles
.Item(i, i).Style.BackColor = dw
.Item(i, 16 - i).Style.BackColor = dw
End Select
Next
I would use a single select case statement for each different type. Of course you could do the same thing with If..then statments but I find in this case using Select...Case is easier and cleaner. Additionally I think I would seperate your board initialization code from your tile placement code. Use the two loops you already have in your button click event to place the controls on the form. I would set each square initially to blank that way you don't have to worry about blanks. Then after that code executes use a single loop that iterates through each row and add all the appropriate select case statments to set each square.
An additional note. I think you have reversed the placement of your rows and columns.
Change this line:
mysquare = New Square(irow * 40, jcolumn * 40)
To:
mysquare = New Square(jcolumn * 40, irow * 40)
|
|
|
|
|
Thank you my scrabble board is working. but second step is that i have to create a tray with Letter ( a,b,c.....Z). and everytime user enter word in textbox and specify the location ( such as row 2 column 3) and click move. whatever user enter in the box has to moved to the scrabble board. can you please help me how should i define my Tiles equal to string letter a. such as i have tiles from A to z. Tile001.jpg is A , Tile002.jpg is B and so on. i dont know how should i declare in my class..... thanks
|
|
|
|
|
I would create a Tile class. It would probably make sense to inherit from picturebox again. A tile has two important properties
1) It's value
2) It's letter
The class could take the letter and value in the constructor. The image to use could be determined by the letter passed. A captitol 'A' has a ascii value of 65 and corrisponds to Tile001.jpg. So to figure out which image to use you could get the ascii value of the letter passed, for example ASC(letter) and subtract 64. You can then construct a string that matches the appropriate image name and set the image for the picturebox.
To place it on the board you could iterate through your 'Tiles' in the rack and test if the letter is the letter needed. If it is you could move it onto the board by adding the Tile object to the control collection of the appropriate square.
|
|
|
|
|
can you plz give me some lines of code. cuz i could not figure out.
|
|
|
|