|
not working
here coding:
",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _
even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _
not working too
|
|
|
|
|
",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _
even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _
The above lines equate to the same sting to send to the database. Both of which have ' around the date still. You don't need the single quotes for dates in access.
Use the following:
",Date= " & "#" & ddate.Text & "#" & _
Mike Lasseter
|
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
You are probably using a date format that the database doesn't recognise.
---
b { font-weight: normal; }
|
|
|
|
|
pls refer to mr_lasseter response , i have try many way of those format. but when i save a new record it able to save it but when update , which mean edit the old record then have problem.
|
|
|
|
|
Guffa's questions are valid. From the last attempt that you made:
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
|
|
|
|
|
I would use the debugger to step the code and see what the update string that is sent to the database looks like. I would take this string and try to run it as a query in access. Figure out what you need to do to the string in order to get it to run in Access, then make the appropriate changes in your code.
Mike Lasseter
|
|
|
|
|
Can you do something like this?
Date= " & "'" & Now.ToShortDateString & "'" & _
Roy.
|
|
|
|
|
having error : Object require.
|
|
|
|
|
Hi:
I have the following code in VB 2005 and I´m using a C++ DLL (SNAPI.DLL) from Symbol (DS6607 Barcode and Image Scanner). On Symbol´s website (www.symbol.com) I found the SNAPI.DLL, SNAPI.LIB and the SNAPI.H files. I am getting a Writing Protected Memory error when I try to read the data returned by the DLL (unmanaged code). Does anyone have any suggestions on where to find a solution?
Thanks for any suggestions.
Jaime A.
Imports System<br />
Imports System.Runtime.InteropServices<br />
Imports System.Resources<br />
Imports System.IO<br />
<br />
.<br />
.<br />
.<br />
<br />
' The SNAPI.dll is an unmanaged DLL written in C++ and we only have available the SNAPI.dll, the SNAPI.lib and the SNAPI.h<br />
Declare Auto Function SNAPI_Init Lib "SNAPI.dll" (ByVal HWND As IntPtr, ByRef DeviceHandle As IntPtr, ByRef NumDevices As IntPtr) As Integer<br />
Declare Auto Function SNAPI_Connect Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr) As Integer<br />
Declare Auto Function SNAPI_Disconnect Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr) As Integer<br />
Declare Auto Function SNAPI_GetSerialNumber Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr, <MarshalAs(UnmanagedType.SysInt)> ByRef SerialNo As IntPtr) As Integer<br />
Declare Auto Function SNAPI_SoundBeeper Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr, ByRef nBeepCode As Byte) As Integer<br />
Declare Auto Function SNAPI_SetVersionBuffer Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr, ByRef DataPtr As IntPtr, ByVal max_length As Int32) As Integer<br />
<br />
'Handles and Messages<br />
Dim Status As Int32 = 0<br />
Dim devhandle As IntPtr<br />
Dim numdev As IntPtr<br />
Dim serialno(255) As Byte<br />
Dim resultStr As String<br />
Dim ptr As IntPtr = Marshal.AllocHGlobal(256)<br />
<br />
' These are some beep codes for the beep functions<br />
Const ONESHORTHI As Byte = &H0<br />
Const TWOSHORTHI As Byte = &H1<br />
Const THREESHORTHI As Byte = &H2<br />
Const FOURSHORTHI As Byte = &H3<br />
Const FIVESHORTHI As Byte = &H4<br />
<br />
'C++ Definitions in SNAPI.H<br />
'SNAPIDLL_API int __stdcall SNAPI_Connect(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_Init(HWND hwnd, HANDLE * DeviceHandles, int * NumDevices)<br />
'SNAPIDLL_API int __stdcall SNAPI_Disconnect(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_SnapShot(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_TransmitVersion(HANDLE DeviceHandle)<br />
'<br />
'SNAPIDLL_API int __stdcall SNAPI_PullTrigger(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_ReleaseTrigger(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetParameters(WORD *Params, int ParamWords, HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_TransmitVideo(HANDLE DeviceHandle) <br />
'SNAPIDLL_API int __stdcall SNAPI_RequestParameters(WORD *Params, int ParamWords, HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_RequestAllParameters(HANDLE DeviceHandle)<br />
<br />
'SNAPIDLL_API int __stdcall SNAPI_AimOn(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_AimOff(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_LedOn(HANDLE DeviceHandle, unsigned char nLEDselection)<br />
'SNAPIDLL_API int __stdcall SNAPI_LedOff(HANDLE DeviceHandle, unsigned char nLEDselection)<br />
'SNAPIDLL_API int __stdcall SNAPI_ScanEnable(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_ScanDisable(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_SoundBeeper(HANDLE DeviceHandle, unsigned char nBeepCode)<br />
'SNAPIDLL_API int __stdcall SNAPI_EnterLowPwrMode(HANDLE DeviceHandle)<br />
<br />
'SNAPIDLL_API int __stdcall SNAPI_RequestScannerCapabilities(HANDLE DeviceHandle)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetParamPersistance(HANDLE DeviceHandle, int bPersist)<br />
'SNAPIDLL_API int __stdcall SNAPI_AbortMacroPdf(HANDLE DeviceHandle) // aborts macro session and throws out any data<br />
'SNAPIDLL_API int __stdcall SNAPI_FlushMacroPdf(HANDLE DeviceHandle)
'SNAPIDLL_API int __stdcall SNAPI_SetParameterDefaults(HANDLE DeviceHandle)<br />
<br />
'SNAPIDLL_API unsigned int __stdcall SNAPI_ReturnDLLVersion(void)<br />
'SNAPIDLL_API int __stdcall SNAPI_GetSerialNumber(HANDLE DeviceHandle,unsigned char * SerialNo)<br />
'
<br />
'SNAPIDLL_API int __stdcall SNAPI_SetVideoBuffer(HANDLE DeviceHandle, unsigned char *pData, long max_length)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetImageBuffer(HANDLE DeviceHandle, unsigned char *pData, long max_length)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetDecodeBuffer(HANDLE DeviceHandle, unsigned char *pData, long max_length)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetVersionBuffer(HANDLE DeviceHandle, unsigned char *pData, long max_length)<br />
'SNAPIDLL_API int __stdcall SNAPI_SetCapabilitiesBuffer(HANDLE DeviceHandle, unsigned char *pData, long max_length)<br />
<br />
'This is the First Subroutine to be called<br />
Private Sub cmdSNAPI_Init_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SNAPI_Init.Click<br />
Status = SNAPI_Init(WinHandle, devhandle, numdev).ToString<br />
End Sub<br />
<br />
'This is the Second Subroutine to be called<br />
'It then calls SNAPI_GetSerialNumber to obtain the serial number from the SYMBOL DS6607 Barcode scanner<br />
<br />
Private Sub cmdSNAPI_Connect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click<br />
lblConnect.Text = SNAPI_Connect(devhandle).ToString<br />
lblDLLVer.Text = "DLL Version: " & SNAPI_ReturnDLLVersion()<br />
Status = SNAPI_GetSerialNumber(devhandle, ptr)<br />
resultStr = Marshal.PtrToStringAuto(ptr, 256)<br />
'@@@@@@@@@@@@@@ I get a ATTEMPTED TO READ OR WRITE PROTECTED MEMORY at this point, any suggestions ? @@@@@@@@@@@@@@<br />
End Sub<br />
<br />
'This is the Last Subroutine to be called to Disconnect from the SYMBOL DS6607 Barcode scanner<br />
Private Sub cmdSNAPI_Disconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSNAPI_Disconnect.Click<br />
Status = SNAPI_Disconnect(devhandle)<br />
End Sub<br />
<br />
Private Sub cmdSNAPI_SoundBeeper_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSNAPI_SoundBeeper.Click<br />
Status = SNAPI_SoundBeeper(devhandle, FIVESHORTHI)<br />
End Sub
|
|
|
|
|
Hi:
I found the problem for this error:
Declare Auto Function SNAPI_GetSerialNumber Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr, ByRef SerialNo As IntPtr) As Integer<br />
<br />
Declare Auto Function SNAPI_GetSerialNumber Lib "SNAPI.dll" (ByVal DeviceHandle As IntPtr, ByVal SerialNo As IntPtr) As Integer
The SerialNo was defined as ByRef when it should have been declared as ByVal.
Jaime Arcila
|
|
|
|
|
This makes no sense. Writing a VB.Net shared addin to work with MS Project. Program runs fine when I have a MsgBox in While loop for diagnostics. When I comment MsgBox out, program does not run to completion. What's going on????
buckeyerog
|
|
|
|
|
You have some sort of race condition. The msgbox is probably creating a pause that means another thread is finishing it's work in time for the main thread to do what it needs to
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That's what I thought, so I put a delay, using the Sleep(), of 100 and 1000 msec. Didn't help. Anything else to try?
|
|
|
|
|
Without knowing anything about what your code is doing or seeing the code with the problem, there's really not much we can tell you. About the only other thing we could say is try dropping a call to DoEvents in place of the Sleep.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm trying to write a shared addin to extract data from MS Project and dump it into Excel or Access. Problem occurs using the TimeScaleData function and I try to access .Value. I'm using IEnumerator, convert the .Value to a string "Convert.ToString(TSV.Value) = "" Then", etc, per the SDK example. Works with the MsgBox as a "delay", bombs without it. Can access other values, ie TSV.StartDate, with no problem, either with or without MsgBox. Don't really want or need any Form; would like to just click on menu item under tools and dump desired data to CSV file.
|
|
|
|
|
The code would still make this easier...
Why are you converting the TSV.Value to a String? Why not just get the value itself and compare on that?
Try getting the value into another variable before you try to do anynthing with it. Do the comparison on that variable instead of the TSV.Value member. Might work, might not...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there,
I want to display child data in a standard datagrid using the .net 2.0 framework.
Its like the tables in access 2003 where you have the small + sign, when there is associated child data.
The standard datagrid displays only a link to the child data instead of displaying them.
I think i need to replace the link to the child data with my own control. But the big ? is how
Or anybody with other solutions suggestions ?
thx
|
|
|
|
|
If you are only looking for one level of child data, have you considered a master/details setup for your grid(s)?
Steve
|
|
|
|
|
Yes i only need one level and have already considered a master / detail layout.
But that does not fits my app.
The thing is that there already are some other fields with rtf data which already displayed in seperate controls. With an extra detail datagrid the form while be a mess for the user.
But thx for the suggestion
|
|
|
|
|
Hi all,
I am developing a small application in VB.NET 2003 that loads just over a 1000 contacts from MS Access and loads them into a datagrid. (That works pretty good, I can even add/edit/delete contacts ok)
I just want it to add the option of importing contacts in a couple of different ways, first one been from MS Excel.
I have no issues loading the excel file to the application, the following is just the two main lines of code where I load the excel file (obviously there is some extra code, I just don't think is relevant at this stage...)
oledbConnExcel.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFilePath & ";Extended Properties=Excel 8.0;"
dt = oledbConnExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
After I am done loading the spreadsheet to a datagrid in a separate form, I make sure that connections and other objects that are no longer required for excel are removed;
oledbConnExcel.Close()
oledbConnExcel = Nothing
After all this my MS Access connection no longer works (even those connection that where ok prior of loading the Excel file)
The following are some of the references for Access connection;
If IsNothing(oledbConn) Then
oledbConn = New OleDb.OleDbConnection
Else
oledbConn.Dispose()
oledbConn = New OleDb.OleDbConnection
End If
oledbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source= " & DBLConnPath & ";User Id=admin;Password=;"
As you can see, even though I use a different object all together I go and recreate the object and the connection every time.
If I don't use the Excel import function, I can dispose, create, etc... as many times as I want to the MS Access database.
I read a lot of forums, and they recommend checking the MDAC (which I did although I didn't have to as for the above sample)
What gives...?
Thanks in advance.
Alain
|
|
|
|
|
In my project i have a requirement of storing Text and Image in Access Database through VB.NET. And Access it back.
And most important thing is the Data (Text + Images + Tables + etc..) Should be displayed in Crystal Report..
One more thing the data has to be in 1 Column. I cannot divide the data.
Can any one plz help....
-- modified at 10:20 Wednesday 23rd August, 2006
Jats
|
|
|
|
|
Hi
I try to use the great looking GoogleTalkForm Component from here:
http://www.codeproject.com/cs/miscctrl/GoogleTalkWindowsForm.asp
I making a standart Windows Project and set a Reference to the "StyledForms" Dll
It works fine to do an instance of the googletalkwindow and show it, but how can i get the
look of this component at designtime to my standart form?
Sorry im not familiar with using extern components :=(
Thx for help
|
|
|
|
|
You need to ask this question in the forum for the component you downloaded.
If the question is that it's not showing in the designer, the VS2005 designer is a lot pickier than 2003, it won't show components that work fine, a lot of the time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have populated a data grid with like this
dim QryFrames As String = "SELECT F.ProductId, F.BrandName, F.Collection, F.Temple, F.Bridge, F.Eye, F.FrameName, F.Color, F.Meterial, F.FrameType,F.FrameShape, F.RimType, F.LenseColor, F.Gender,F.QtyInHand,F.ReorderLevel FROM Frames AS F INNER JOIN Stock AS S ON F.ProductId = S.ProductId and F.GrnNo=S.GrnNo"
ds = classes_obj.getRecord(QryFrames)
dgAddReorder.DataSource = ds.Tables(0)
here getRecord function return dataset for passes qry string.
this works on index change event of combo box.
my problem is user change combo box selected item this return (populate data grid) different order.that mean not in same order.
eg. say i want to get ReorderLevel for last column of data grid.so i place it as last item of Qry.but different times it get different location.(but first time ok. i think this because of cashing or something of dataset.)
i want to get this same position every time.
regards.
amila pradeep
|
|
|
|
|