|
More Info....
I have modified the structure as follows
Try
objCommand = New OleDb.OleDbCommand
objCommand.Connection = objConnection
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Add("@CustNum", OleDb.OleDbType.Variant, 50, "99999")
objCommand.Parameters.Add("@CustName", OleDb.OleDbType.Char, 50, "Test1")
objCommand.Parameters.Add("@CustContact", OleDb.OleDbType.Char, 50, "Test User")
objCommand.Parameters.Add("@CustAdd1", OleDb.OleDbType.Char, 50, "123 Your Street")
objCommand.Parameters.Add("@CustAdd2", OleDb.OleDbType.Char, 50, "Apt C")
objCommand.Parameters.Add("@CustCity", OleDb.OleDbType.Char, 50, "Your City")
objCommand.Parameters.Add("@CustState", OleDb.OleDbType.Char, 2, "OH")
objCommand.Parameters.Add("@CustZip", OleDb.OleDbType.Char, 50, "99999")
objCommand.Parameters.Add("@CustPhone", OleDb.OleDbType.Char, 50, "1234567890")
objCommand.Parameters.Add("@CustFax", OleDb.OleDbType.Char, 50, "1234567891")
objCommand.Parameters.Add("@CustEmail", OleDb.OleDbType.VarChar, 50, "test@test.com")
objCommand.CommandText = "usp_AddCustomer"
objConnection.Open()
objCommand.ExecuteNonQuery()
Catch OleDbExceptionErr As OleDbException
MsgBox(OleDbExceptionErr.ToString)
End Try
I am now just trying to do hard coded strings, and when I run it with the try...catch block, I get teh following error:
System.Data.OleDb.OleDbException: Parameter [@CustNum] has no default value.
Jay Davis
|
|
|
|
|
Just to add my 2 cents...
First, forget everything you know about real SQL. Access/Jet doesn't support a lot of it.
Access/Jet doesn't support named parameters. You CAN name them for a bit of clarity when you read the SQL statement, but the names are not used. There parameters you add must be supplied in the same order that they appear in the SQL statement. This also means you can't skip parameters. If a parameter in your statement can be blank, you have to supply it as a blank, null, or 0 value.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there some sample code?
Thanks!
|
|
|
|
|
Just don't do it. Direct Show is incredibly buggy. USe the Windows Media Player control instead.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello,
Any ideas on how i could dynamically add a detail section to a crystal reports object at run-time, the new details section would also need to have a sub report in it, but that is another matter.
any help much appreciated.
Thanks,
Kristian
|
|
|
|
|
Down the line of code i get one error (EventArgs.pPacket.Data(I)) pPacket is not a member of system.eventArgs
thispacket = ""
For I = 0 To e.pPacket.DataSize - 1
thispacket = thispacket & Chr(EventArgs.pPacket.Data(I))
Next
-----------------------------------------------------------------------------
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With lvpackets
.Columns.Add("Form", .Width / 3, HorizontalAlignment.Left)
.Columns.Add("To", .Width / 3, HorizontalAlignment.Left)
.Columns.Add("Size", .Width / 3, HorizontalAlignment.Left)
.View = View.Details
End With
End Sub
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstart.Click
Me.AxPacketXCtrl1.Start()
End Sub
Private Sub axpacketxctrl1_OnPacket(ByVal eventsender _
As System.Object, ByVal e As _
AxPacketXLib._IPktXPacketXCtrlEvents_OnPacketEvent) _
Handles AxPacketXCtrl1.OnPacket
Dim I As Short
Dim thispacket As String
Dim sourceip As String
Dim destip As String
Dim item As New ListViewItem
thispacket = ""
For I = 0 To e.pPacket.DataSize - 1
thispacket = thispacket & Chr(EventArgs.pPacket.Data(I))
Next
If e.pPacket.Data(14) = 69 And e.pPacket.Data(23) = 6 Then
sourceip = e.pPacket.Data(26) & "." & _
e.pPacket.Data(27) & "." & + _
e.pPacket.Data(28) & "." & + _
e.pPacket.Data(29)
destip = e.pPacket.Data(30) & "." & _
e.pPacket.Data(31) & "." & + _
e.pPacket.Data(32) & "." & + _
e.pPacket.Data(33)
item.SubItems(0).Text = sourceip
item.SubItems.Add(destip)
item.SubItems.Add(e.pPacket.DataSize)
lvpackets.Items.Add(item)
End If
End Sub
End Class
|
|
|
|
|
Delo wrote:
i get one error (EventArgs.pPacket.Data(I)) pPacket is not a member of system.eventArgs
Should not the line be e.pPacket.Data(I) ?
Charlie
if(!curlies){ return; }
|
|
|
|
|
|
I have to agree with Charlie that EventArgs.pPacket definitely cannot be right. That is a type, NOT an argument. I feel certain it should be e.pPacket, like Charlie said.
But this line also looks suspicious:
AxPacketXLib._IPktXPacketXCtrlEvents_OnPacketEvent
Should that period underscore (._) be there?
Changing the line to either:
AxPacketXLib_IPktXPacketXCtrlEvents_OnPacketEvent
or
AxPacketXLib.IPktXPacketXCtrlEvents_OnPacketEvent
both look more like legitimate event signatures to me.
Maybe that's why the changes Charlie suggested did not work.
Also, this is obviously either a custom control or a 3rd party control. There's not much way anyone can helkp you with a control they have no information on ...
Good Luck,
Robert
|
|
|
|
|
sorry charlie you were right and robert you put it in a way that made me see it more clearly
thank you both
|
|
|
|
|
Hi,
I have created a number of form for user input, as they are more or the same I created a routine that creates the form in runtime (adding all the controls at runtime). What I now want to do is to have the save button to get enabled as soon as one of the controls has been changed. As I don't have the controls on the form during design time I am having problems using a eventhandler, basically I don't know how. So what I am asking is how do I create an eventhandler, or something else, in the controls I am adding that trigger an event on the form so that I can enable the Save button. Any pointers would be much appreciated.
DJ
Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
|
|
|
|
|
Well, you did not specify VB6 or VB.NET, so I will not give much detail.
Basically the approach is:
VB6 - you have to already have a placeholder control of every type you want add at runtime and add then as a control array. So you just write a single handler and enable the the save button when anyone changes. Or you could process each control in a different way if you know in advance what their array indexes will be.
VB.NET
Create event handlers and add them to the dynamic controls using the syntax:
AddHandler <control name and event> AddressOf <event handler method>
Robert
|
|
|
|
|
Hello,
I want to know that how can i move the Recordset to end of file in VB.NET. In vb6, i use that code.
Do While Not Category.EOF
Combo2.AddItem Category(0) & " " & Category(1)
Category.MoveNext
Loop
but in Vb.net there is no function of 'EOF'
Kindly tell me that how can i reuse this code in VB.net. What changes i can make in this code.
Regards,
Eshban
EsHbAn BaHaDuR
|
|
|
|
|
Recordset? That's an ADO object, not a VB.NET or .NET Framework object. EOF doesn't move the cursor to the end of the set, it just checks to see if the cursor is AT the end of the set.
What is "Category" defined as? Could you show us the code that defines "Category"? Is it an ADO Recordset or a .NET Framework DataSet, or what?
If it's an ADO Recordset object, then call its MoveLast() method to move the cursor to the last record in the set.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Category is an ADO Recordset.
EsHbAn BaHaDuR
|
|
|
|
|
Category? Whatever....
Then just call .MoveLast() on your RecordSet object and the cursor will be on the last record in your set... Simple.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can someone help, I'm having a brain fart (new to vb.net)?
Have a form with multiple radio buttons. When a user selects a radio button, then clicks submit, a form based on the selection will open.
What is the simplest 'select case' code to do this?
Thanks
|
|
|
|
|
i think in that situtaion u cannot use SElect Case, ElseIf more efficent
if RadioButton1.Checked then
'Open Form1
dim _frm as new Form1
Form1.ShowDialog
ElseIf RadioButton2.Checked then
'Open Form2
ElseIf RadioButton3.Checked then
'Open Form3
Else RadioButton4.Checked then
'Open Form4
End If
|
|
|
|
|
Hi! I have a panel that is constitued by a label and two other elements.One of them is a picturebox which i use to "collapse" the child pannels into just the label.Then pressing the picture again, the child pannel returns to its original size.The thing is that when the panel returns to the original size, there is a bit of a flicker in the panel, like an element that was there and then it isn't no more.Can anyone help me to eliminate this annoying flicker?
Thanks in advance
Never say never
|
|
|
|
|
Hi,
I'm trying to save the contents of a listbox to a text file but have no idea how to get it done.
if anyone can help it would be great
|
|
|
|
|
use that code.
Dim xFile As System.IO.File
Dim xFileName As String = "C:\ListBox.txt"
Dim xFileWriter As System.IO.StreamWriter
xFileWriter = xFile.CreateText(xFileName)
' (-)in {0,-30} means in LeftAlignment and 30 is charecter count
For i As Short = 0 To ListBox1.Items.Count - 1
xFileWriter.WriteLine("{0,-30}", ListBox1.Items(i))
Next
xFileWriter.Close()
xFileWriter = Nothing
xFile = Nothing
|
|
|
|
|
Hi Thanks for your reply. I am using VB 6 which I forgot to mention. Do you know the code for VB 6.
Thanks
|
|
|
|
|
Dim mDab as new filesystemobject
dim mtxt as textstream
dim mFile as file
dim i as integer
call mDab.createtextfile("c:\list.txt")
set mfile = mDab.getfile("c:\list.txt")
set mtxt = mfile.opentextstream(forwriting)
for i = o to listbox1.items.count-1
call mDab.writeline(listbox1.item(i))
next
call mtxtstream.close 'put this line in the private sub Form_Terminate() ok
it will solve ur problem
:->
Thanks alot
Hamody
|
|
|
|
|
How can I change an Excel worksheet column's format in vb6.
I can open an Excel app and write to it, but if I write text like "00100" it loses the 0's and becomes "100" because the column format is General. How can I change it to Text in code?
1fm1fu
|
|
|
|
|
The quick way to do it is to use "'00100" or write a quick function to append the ' to the front of the value.
Or set the numberformat property for the range then the value as below:
Dim c As Range
Set c = Worksheets("Sheet1").Range("A1")
c.NumberFormat = "@"
c.Value = "00100"
|
|
|
|
|