|
|
I am trying to insert a row into a access database with information taken from user input.
Here is the code i am using. It will not build i get an Constant expression is required error. can someone please tell me how to insert a row into a database with the users input.
Thank you,
Santana
Try
Const insertstr As String = "insert into newAuthors (authorID,firstName,lastName) values (" & txtacctnum.Text & "," & txtstartdate.Text & "," & txtenddate.Text & ")"
Dim cnn As New OleDbConnection(strCnn)
Dim cmd As New OleDbCommand(insertstr, cnn)
cnn.Open()
cmd.ExecuteNonQuery()
cnn.Close()
Catch oleDbExceptionParameter As System.Data.OleDb.OleDbException
MsgBox("Invalid Query")
End Try
|
|
|
|
|
can you try your insert without going thru the code..just directly in the database to make sure u have the correct syntax?
|
|
|
|
|
=================================================================
I think that , if the authorid is integer you must use
....cint(txtacctnum.Text )....
because (textbox?.text) will return string and authorid is integer !!!! wrong
Think Before Begin
|
|
|
|
|
I am trying to bind object together from access to visual. I am in the process of writing the code. I keep on getting the same error and don't know why. I have this so far.
dim partInformation as Binding
partInformation = new binding ("Text", dsParts1,_
"tblParts.fldpartNumber")
Under part information on the 2nd line the error that is coming up is - Declaration expected.
Under "tblParts.fldpartNumber" the error is Syntax error.
What am I doing wrong?
Thank you,
ibok23
|
|
|
|
|
Could somebody tell me what I am doing wrong? This is what I have...
Dim partInformation As Binding
partInformation = New Binding ("Text", dsParts, "tblParts.fldpartNumber")
txtpartNumber.dataBinding.add(partInformation)
partInformation = New Binding ("Text", dsParts, "tblParts.flddescription")
txtDescription.dataBinding.add(partInformation)
partInformation = new binding ("Text", tblParts.fldquanityOnHand")
txtquanityOnHand.dataBinding.add(partInformation)
partInformation = new Binding ("Text", tblParts.fldcost")
txtcost.dataBinding.add(partInformation)
partInformation = new binding ("Text", tblParts.fldsalesPrice")
txtsalesPrice.dataBinding.add(partInformation)
I am getting an error on all of the partInformation except for the dim. It says declaration expected. I am also getting an error on all the txt before the dataBinding saying declaration expected.
Thank you,
ibok23
|
|
|
|
|
hello
may i know how do i select a data in flexgrid
and then show it in another form
please help me
im using vb6
thank you
Gary
|
|
|
|
|
'This is on the main form
Dim strCustData(0 To 12) As String
Dim lngClientId As Long
Dim bytCount As Byte
With grdClients
If .TextMatrix(.Row, 0) = "" Or .TextMatrix(.Row, 1) = "N/A" Then
MsgBox "Please Select a Record"
Exit Sub
Else
lngClientId = .TextMatrix(.Row, 0)
For bytCount = 0 To UBound(strCustData, 1)
strCustData(bytCount) = .TextMatrix(.Row, bytCount + 1)
Next bytCount
End If
End With
Call Load(frmUpdate)
With frmUpdate
.MP_ClientDetails lngClientId, strCustData
.Show vbModal
End With
----------------------------------------------
'This is a function in the receiving page
Public Sub MP_ClientDetails(lngClientId As Long, strCustData() As String)
Dim bytCount As Byte
For bytCount = 0 To UBound(strCustData, 1)
txtCustDetails(bytCount).Text = strCustData(bytCount)
Next bytCount
exit sub
Hope this helps!
|
|
|
|
|
hii
will this also work if i have this module??
Public Function AutoComplete(sTextbox As TextBox, sFlexGrid As MSFlexGrid, sDB As Database, sTable As String, sField As String) As Boolean
On Error Resume Next
Dim sCounter As Integer
Dim OldLen As Integer
Dim sTemp As Recordset
AutoComplete = False
If Not sTextbox.Text = "" Then
OldLen = Len(sTextbox.Text)
Set sTemp = sDB.OpenRecordset("SELECT * FROM " & sTable & " WHERE " & sField & " LIKE '" & sTextbox.Text & "*'", dbOpenDynaset)
If Not sTemp.RecordCount = 0 Then
If sTemp.EOF = True And sTemp.BOF = True Then
MsgBox "Not Matching Records", vbInformation, "Error"
Else
sTemp.MoveFirst
sFlexGrid.Clear
sFlexGrid.FormatString = "Book Name |ISBN |Author |Book In-Store"
Do While Not sTemp.EOF
sFlexGrid.AddItem sTemp.Fields(0).Value
sFlexGrid.TextMatrix(sFlexGrid.Rows - 1, 1) = sTemp.Fields(1).Value
sFlexGrid.TextMatrix(sFlexGrid.Rows - 1, 2) = sTemp.Fields(2).Value
sFlexGrid.TextMatrix(sFlexGrid.Rows - 1, 3) = sTemp.Fields(3).Value
sTemp.MoveNext
Loop
End If
If sTextbox.SelText = "" Then
sTextbox.SelStart = OldLen
Else
sTextbox.SelStart = InStr(sTextbox.Text, sTextbox.SelText)
End If
sTextbox.SelLength = Len(sTextbox.Text)
AutoComplete = True
Else
sFlexGrid.Clear
End If
End If
End Sub
this must be available in it.
so this means i put the code in the
Flexgrid or the form_load?
im not really sure
please tell me
thank you
Gary
|
|
|
|
|
Hi Gary
Could you elaborate on what it is exactly you are trying to do?
Is your question... When I select a row of info on a grid, how do I populate another page with the selected data??
Cliff
|
|
|
|
|
well the module is to select all the data from DB
when the textBox is fill the flexgrid will show the data in the flexgrid
so..
i want to know is that when i select the row of data using the code u gave me
it will show in other form, right?
then where should i put the code
in the flexgrid? module? or in the form_load?
actually you can ignore the module i send to you
and thank you Cliff
Gary
|
|
|
|
|
Hey Gary
Ok... Once you have populated your flexgrid:
You will select a row of data by clicking on the flexgrid row.
Then(just as example) you have a command button called cmdENTER.
When you have selected a row and then click cmdENTER,
you put the selected rows information in an array called strCustData.
It has been dimentioned to (0 to 12) because there are 13 columns in my
row.
'So this code will go in the same form as your selected flexgrid
'Copy this code into VB, it will be easier to read
Private sub cmdENTER_Click()
Dim strCustData(0 To 12) As String
Dim lngClientId As Long
Dim bytCount As Byte
With grdClients
'This just checks if a valid record was selected
If .TextMatrix(.Row, 0) = "" Or .TextMatrix(.Row, 1) = "N/A" Then
MsgBox "Please Select a Record"
Exit Sub
Else
'Sets my variable to the first column's value of the selected row
lngClientId = .TextMatrix(.Row, 0)
'here we assign the rows values to our array
For bytCount = 0 To UBound(strCustData, 1)
strCustData(bytCount) = .TextMatrix(.Row, bytCount + 1)
Next bytCount
End If
End With
'Now we call our next form where you want the selected row's data
' to be displayed
'Load the form
Call Load(frmUpdate)
With frmUpdate
'Then in frmUpdate create a Public Sub call MP_ClientDetails
'and here we call that Sub and pass through our array
'strCustData)
.MP_ClientDetails lngClientId, strCustData
.Show vbModal
End With
End Sub
'Here is the code for that Public Sub which should be in frmUpdate
Public Sub MP_ClientDetails(lngClientId As Long, strCustData() As String)
Dim bytCount As Byte
'Here we assign the values from our Array into the textboxes on
'frmUpdate (Obviously this could be changes to a grid or ??)
For bytCount = 0 To UBound(strCustData, 1)
txtCustDetails(bytCount).Text = strCustData(bytCount)
Next bytCount
End Sub
I really suck at explaining things but hope this helps a little.
If confusion reigns just tell me and I will try explain in a different way
Regards
Cliff
|
|
|
|
|
hi cliff
thank you for your help
it really work
thank you very much
|
|
|
|
|
Have a canvas 700 x 500.
Want to paste an image on it . My image can be smaller or bigger than the Canvas. Smaller image fits fine on the canvas...
But if I have an image larger than the canvas...how can I resize it without blurring the image??
I believe photoshop can reduce image size without blurring/squeshing the image..so, it reduces the image without messing it up...
Is this doable in .Net? Ca i resize/reduce an image to fit a 700x500 canvas without messing up how the image looks??
any ideas/sample code/website would be great to get me going...
|
|
|
|
|
I think all you need to do is set the InterpolationMode to Bicubic instead of Default.
Example:
e.Graphics.InterpolationMode = Drawing.Drawing2D.InterpolationMode.Bicubic
e.Graphics.DrawImage(bmpImage, destRect, srcRect, GraphicsUnit.Pixel)
Look up InterpolationMode in the help for all of the different modes.
To not know is bad.
To not wish to know is worse.
|
|
|
|
|
hmmm, I will... i didnt see InterpolationMode.Bicbic in Scott Mitchell's dicusstion but will look into it.
Thanks for the lead.
|
|
|
|
|
To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type.
Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy)
select cast(37954 as datetime) as startdate
But VB6 thinks it is 29-11-2003
?Format(37954, "dd-mm-yyyy")
How is this possible? What am i doing wrong?
Grtz,
Guus
|
|
|
|
|
|
I don't have any Idea.
Sorry but it seems awkward to use integers for dates.
I think youd be better off using normal Date data.
or I suggest ask the one who adviced you.
Marvin N. Guerrero
- Casting More!!
|
|
|
|
|
In any format, dd-mm-yyyy or mm-dd-yyyy 73584 still means December 1st 2003. You have to retrieve the regional settings to get it right. That's why i use integers.
|
|
|
|
|
Have you tried storing dates as strings?
Easy to display in the format you want and easy to convert correctly to date/time format for any calculations that you need to perform on them.
Just be sure to confirm the value is a valid date before storing (use isdate() function)
Jon
|
|
|
|
|
Please give me details or the source code or atleast a logic to decode or analyse the FTP address or parameters from a packet sent through a network. I am doing a LAN sniffer.
|
|
|
|
|
I need some help... Is anyone aware of a product which can reverse engineer a dll-file, so I can understand what it does...
|
|
|
|
|
You are aware that reverse engineering is prohibited by the vast majority of license agreements.
However, if you are entitled to reverse engineer the DLL then it depends if it is a .NET DLL or a native DLL.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Also, you'll get the not-so-easy-to-read assembly code for the .DLL, not C++ or VB...
RageInTheMachine9532
|
|
|
|