|
It would not be feasible for me to create a report just for this... however, I am sure that what you seek is available within the first few links of the google search I sent you. Did you try looking there?
|
|
|
|
|
I solved !!!!!!!!!!!!!!! ChandraRam thanks!
|
|
|
|
|
dario Gogliandolo wrote: I solved !!!!!!!!!!!!!!! ChandraRam thanks!
I'm glad you did... You are welcome
|
|
|
|
|
Why my program "sleep" when I use this code for export data from one Database to another
Public Sub uchenici_DataU()
If Exists(strAcessFilePath11 & "\Update.mdb") Or Exists(strAcessFilePath11 & "\Update.accdb") Then
Dim selectdata2 As String
selectdata2 = "SELECT Students.[ID number], Students.[Name 1], Students.[Name 2], Students.[Name 3], [Code Class].[Class No], [Code Paralell class].[Paralell class Name], Students.Address FROM (([C<ode Paralell class] INNER JOIN [Code Class] ON [Code Paralell class].[Paralell class ID] = [Code Class].[Paralell class]) INNER JOIN [Class Details] ON [Code Class].[Class ID] = [Class Details].Class) INNER JOIN (Students INNER JOIN StudentClass ON Students.[ID number] = StudentClass.[ID number]) ON ([Class Details].BasicClass = StudentClass.BasicClass) AND ([Class Details].Group = StudentClass.Group) AND ([Class Details].Class = StudentClass.Class) WHERE (((StudentClass.[Position])=1)) ORDER BY [Code Class].[Class No], [Code Paralell class].[Paralell class Name]"
Dim strConn As String
Dim reader1 As OleDbDataReader
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strAcessFilePath3 & ";User ID=Admin;Password="
Using theConnection As New OleDbConnection(con_str)
theConnection.Open()
Using OleDbCommand2 = New OleDbCommand(selectdata2, theConnection)
reader1 = OleDbCommand2.ExecuteReader()
FlowLayoutPanel1.Visible = True
ProgressBar1.MarqueeAnimationSpeed = 50
ProgressBar1.Style = ProgressBarStyle.Marquee
While (reader1.Read())
masiv(0) = reader1.Item(0)
If masiv(0).Length = 8 Then
masiv(0) = "00" & masiv(0)
ElseIf masiv(0).Length = 9 Then
masiv(0) = "0" & masiv(0)
End If
masiv(1) = reader1.Item(1).ToString & " " & reader1.Item(2).ToString & " " & reader1.Item(3).ToString
masiv(2) = reader1.Item(4) & reader1.Item(5)
masiv(3) = reader1.Item(4)
masiv(4) = reader1.Item(6).ToString
Get_egn()
If vzemi_egn = "" Then
prehvyrlqne_ot_DGrid()
End If
End While
FlowLayoutPanel1.Visible = False
reader1.Close()
End Using
End Using
' Else : MsgBox("Файлът DataU не съществува в директорията " & DataDir1, MsgBoxStyle.Critical, "Не съществуваща БД")
Else : MsgBox("Файлът Update не съществува", MsgBoxStyle.Critical, "Не съществуваща БД")
End If
'Else : MsgBox("Файлът Update не съществува", MsgBoxStyle.Critical, "Не съществуваща БД")
'End If
End Sub
Private Sub prehvyrlqne_ot_DGrid()
'If da Then
Dim strCon As String
Dim param1 As OleDbParameter
Dim param2 As OleDbParameter
Dim param3 As OleDbParameter
Dim param4 As OleDbParameter
Dim param5 As OleDbParameter
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strAcessFilePath1 & ";Jet OLEDB:Database Password=ipek0809;"
Using theConnection As New OleDbConnection(strCon)
' OleDbConnection1 = New OleDbConnection(strCon)
theConnection.Open()
strQuery = "insert into uchenici (egn, stname, klas, klas_rim, adres) values(?,?,?,?,?)"
' Using cmd = New OleDbCommand("select", cn)
Using OleDbCommand1 = New OleDbCommand(strQuery, theConnection)
param1 = New OleDbParameter("@avtor", OleDbType.VarWChar, 100)
param2 = New OleDbParameter("@egn", OleDbType.VarWChar, 100)
param3 = New OleDbParameter("@egn1", OleDbType.VarWChar, 100)
param4 = New OleDbParameter("@egn2", OleDbType.Integer)
param5 = New OleDbParameter("@adres", OleDbType.VarWChar, 100)
param1.Value = masiv(0)
param2.Value = masiv(1)
param3.Value = masiv(2)
param4.Value = masiv(3)
param5.Value = masiv(4).ToString
OleDbCommand1.Parameters.Add(param1)
OleDbCommand1.Parameters.Add(param2)
OleDbCommand1.Parameters.Add(param3)
OleDbCommand1.Parameters.Add(param4)
OleDbCommand1.Parameters.Add(param5)
OleDbCommand1.ExecuteNonQuery()
End Using
End Using
End Sub
Public Sub Get_egn()
Dim selectdata2 As String
Dim param11 As OleDbParameter
selectdata2 = "SELECT * FROM uchenici WHERE egn=?"
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strAcessFilePath1 & ";Jet OLEDB:Database Password=ipek0809;"
OleDbConnection3 = New OleDbConnection(strConn)
OleDbConnection3.Open()
OleDbCommand3 = New OleDbCommand(selectdata2, OleDbConnection3)
param11 = New OleDbParameter("@egn", OleDbType.VarWChar, 100)
param11.Value = masiv(0)
OleDbCommand3.Parameters.Add(param11)
vzemi_egn = OleDbCommand3.ExecuteScalar
OleDbCommand3.Dispose()
OleDbConnection3.Close()
End Sub
modified on Wednesday, January 26, 2011 3:06 PM
|
|
|
|
|
That code dump is not formatted and unreadable, please edit your message and add PRE tags.
ivo75 wrote: Why my program "sleep"
You probably mean the GUI freezes (i.e. high CPU load, no Form resize/repaint; a sleeping program would not cause any CPU load), which would suggest you have too much going on in some event handler; if so, the solution is using one or more additional threads (Thread, ThreadPool, BackgroundWorker, etc).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I insert in SQL statment another SQL statment maybe for this is hapent this.
|
|
|
|
|
Your SQL operations really are too complex, and hence will take too long, to run them on the main thread. I suggest you use a BackgroundWorker and use its progress reporting to update the GUI (the DoWork handler itself is not allowed to touch the GUI Controls!).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
give me some example how to use BackgroundWorker
|
|
|
|
|
Of course, Sir. Here you go, Sir: examples[^].
Anything else you require, Sir?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks
|
|
|
|
|
Hi,
I am printing Crystal reports via VB.Net. Some of the printers are set to print duplex others are not. I want to set the printers duplex option to off when ever I run the code. What is the best way of doing this. What do I have to import/do to achieve this? I have tried importing SystemManagement but no success. What am I doing wrong. Any sample would be welcome.
|
|
|
|
|
Well you should definitely be able to do it using WMI and the Win32_PrinterConfiguration[^] structure.
This[^] thread on MSDN has the basics.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Thanks for the speedy reply.
How would this code/structure be displayed on the project.
Sorry for this.
|
|
|
|
|
Central_IT wrote: How would this code/structure be displayed on the project.
Normally it wouldn't be 'displayed' so I am a little confused by your question.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Hi,
I think I am getting mixed up. The question I meant was "How can I set the code so that my printer does not print duplex"
What is the syntax and what class do I import. It has been a long time since I did any real coding and I am a wee bit rusty. You can properly tell with this question...getting old.
|
|
|
|
|
If you click on the second link in my first reply and scroll down to the answer from 'JWolf011' and look at the code he has posted.
You have not show us the code you are using so I cannot tell you exactly where you should put that code but for an example suppose that you have a Button to turn off Duplex. Double-click the Button to get the template for its Click handler in your code window.
Inside the new handler type the code from that link (leave out the two Debug.Print lines, if you like and you must change mo.SetPropertyValue("Duplex", True) to mo.SetPropertyValue("Duplex", False) ).
Then when you run your application and click that Button it should turn off Duplex. Then do your normal printing.
If it works then move the code into your normal print routine.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
I tend to install duplex capable printers twice, once for simplex, and once for duplex. Then it is all a matter of choosing the right printer.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi all
I have a ms access database with few tables. I nned to draw a graph/chart using the tables in excel.
Is it possible to do with vb.net coding?
If possible, any suggestion and references will be very much helpful.
Thanks in advance.
|
|
|
|
|
|
Thanks for the link.
Will checkout.
|
|
|
|
|
I have combo box that is loaded dynamically. When the user select Misc from the list I want to unhide a text field. I recived the following error.
System.NullReferenceException: Object reference not set to an instance of an object.
at ACEPackaging.dlgEditSkidWeight.HideCarrerTextBox()
etc
etc
etc
Here is my code that is called when the user changes the selection on the combobox.
If CStr(cboCarrier.SelectedValue.ToString) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
End If
I did a little research and said that this error is caused by the .ToString being Null or Nothing. So here is what I have added to correct the problem so there are no more errors. Please let me knwo if this will work.
If Not cboCarrier.SelectedValue.ToString Is Nothing Then 'added this line
If CStr(cboCarrier.SelectedValue.ToString) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
End If
|
|
|
|
|
ToString being Nothing wouldn't cause that problem... More likely, SelectedValue is the problem. Also, Using CStr on something that's already gone through ToString is redundant... A better way would be:
If Convert.ToString(cboCarrier.SelectedValue) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
As Convert.ToString can handle a null/Nothing argument, and would just return "".
|
|
|
|
|
What if the object hasn't been set?
|
|
|
|
|
If SelectedValue is nothing, Convert.ToString will return an empty string.
If the object itself is nothing, you'll still get the error... But I'm assuming this is just a named control, which would be set as soon as the window/form is instantiated.
|
|
|
|
|
Assuming your ComboBox list does not hold any item that is Nothing, this should do:
tbCarrierDesc.Visible = cboCarrier.SelectedIndex >= 0 AND cboCarrier.SelectedValue.ToString = "99"
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|