|
Hello
I am learning VB.NET and was toying with the idea of embellishing my database program with Crystal Reports to provide some data reporting facilities.
I was put off by the cost of Crystal, however, and was wondering if there were any free or very low cost report writers that would work with VB.NET. I want to run the reports from within VB, extracting the data either from Access or SQL Server.
If anyone knows of any such report writers, I would be very grateful to hear from them.
Many thanks,
Trimtrom
|
|
|
|
|
Hi. I am writing a data web service in VS 2005 using Ms Sql Server 2005 as data server. I wrote a connection strin gin the web.config file in the area. I used it in the code, but when I invoke it, it doesnt bring up the details. I know there is some data in the table, but it doesnt bring it up via the web service call.
what would I be doing wrong?
|
|
|
|
|
Hi all,
Please help !
Can I pass array parameters to SQL stored Procedure?
Example...
I hava stored procedure like follow
'*********************************************
@Ids varchar(128)
SELECT [LastName] FROM Employees WHERE EmployeeID IN (@Ids)
'*********************************************
When I pass (@Ids = "'1','2','3'") It didn't work.
I don't want directly use commandText.
What should I do?
!Thanks!
!alien!
|
|
|
|
|
No, you can't pass an array to a stored procedure.
You could create a table variable and put the values into that. There is no command to split the string, though, so you would have to do it with string manipulation.
Here's an example of using a table variable, though:
<br />
set nocount on<br />
declare @t table (id varchar(10))<br />
insert into @t values('1')<br />
insert into @t values('2')<br />
insert into @t values('3')<br />
select [LastName] from Employees where EmployeeID in (@t)
Or perhaps the last line has to be:
select [LastName] from Employees where EmployeeID in (select id from @t)
---
b { font-weight: normal; }
-- modified at 5:36 Saturday 4th February, 2006
|
|
|
|
|
Hello!
My aim is to access to scanner and scann the photos or documents via vb.net. Is there any sample code about how to do that in vb.net?
Thanks!
|
|
|
|
|
am porting a vb library to vb.net. The vb library has an external
call to an unmanaged dll.
Existing code:
//External function declaration
Private Declare Function Uncompress& Lib "COMPR.DLL" (ByVal SrcSt$,
ByVal SrcLen&, Dest As Any, ByVal DestLen&)
//Invocation of external function
lReturn = Uncompress(sCompressedResult, Len(sCompressedResult),
aResults(ARRAY_START), ByVal lNewLength)
[where aResults is a double array. The COMPR.Uncompress function
basically uncompress a string 'sCompressedResult' and fills the array
aResults. The array is initialized before calling the external
function]
My understanding is that( Please correct me if I am wrong):
a. The third parameter in declaration 'Dest as Any' means a parameter
of variant type.
b. At invocation, the first element of the double array is passed.
i.e., a pointer to the first element in the double array is passed to
the external function.
c. The Uncompress function expands the compressed data, fills/replaces
the double array with values.
d. The changed values are available to the caller after the Uncompress
function has returned.
Now, I have to call the COMPR.Uncompress method from Vb.Net.
>From browsing the net, I got a lot of information regarding this(
Please correct me if I am wrong):
a. We have to mark the parameter as InAttribute(), Out().
b. We should pin the object so that GC does not change address.
c. We should pass a pointer TO THE FIRST OBJECT OF THE ARRAY to the
native function.
d. Array of type double is non-blittable and so we have to do the
marshaling.
This is the code I wrote:
//External method declaration
<dllimport("compr.dll", entrypoint:="UnCompress" ,=""
setlasterror:="True," charset:="CharSet.Auto," exactspelling:="True,"
callingconvention:="CallingConvention.StdCall)"> _
Public Shared Function UnCompress(ByVal compressedResult As String,
ByVal length As Long, <inattribute(), out(),=""
marshalas(unmanagedtype.struct)=""> ByRef destinationArrayElement As
Object, ByVal newLength As Long) As Long
End Function
//Invocation
'Pin the object
Dim resultsHandle As GCHandle
resultsHandle = GCHandle.Alloc(aResults(ARRAY_START),
GCHandleType.Pinned)
Dim resultsPointer As IntPtr = resultsHandle.AddrOfPinnedObject()
'Invoke
returnValue = UnCompress(sCompressedResult, Len(sCompressedResult),
resultsPointer, newLength)
My problem is that I get the return value correctly, but the array does
not get changed....I get the same data that is passed to the external
function. I think the changes made by the native function is not
persisting.
There is no problem with any of the parameters - I have checked the
same parameters using the existing vb dll and it works. I would like to
know why I dont get the modified array even though I am passing a
pointer to the first element of the array and am pinning the element.
Is this the correct way to marshal (UnmanagedType.struct) and is this
the correct way to pin object?
Any help would be appreciated,
Jim
Jim
|
|
|
|
|
hi every one,
i have values in external array.
Like
str(0)="1234"
str(1)="3 94 34"
i want to send this values into the databse.
all fields in the database are Varchar of size (30).
when i am sending values into the database
like..
insert into tblone(no,no1)values('"& str(0) & "','"& str(1) &"')
i am not getting any problem.
but when i do like this
insert into tblone(no,no1)values("& str(0) & ","& str(1) &")
(removed single quotes) i am getting syntax error.
can any body help me...
raj
|
|
|
|
|
Values for Varchar(),Date etc Fields must be enclosed in Single Quote and for Numeric Field with out Single Quote. It is syntax nothing more.
Regards,
Javed
|
|
|
|
|
As Javed alluded to, inserting string data into a db requires Double Quotes.
-- modified at 4:13 Saturday 4th February, 2006
|
|
|
|
|
Ok I've looked all over the place here and on other forums and surpprizingly I can't find this anywhere.
How do I get the IP Address my browser is at right now and display it in my addressbar (a.k.a TextBox1)?
Thanx for any help you can give me.
|
|
|
|
|
There are two answers to this depending on what you are really looking for:
First, the really ipaddress can be obtained from the DNS object in the framework. you textbox assignment would look something like: text1.value = system.Net.Dns.GetHostByAddress.tostring()
However, if you are doing asp.net, you may really desire what the url adress bar "server" name is for example:
http://www.codeproject.com/script/comments/user_reply.asp
the server name is "www.codeproject.com" which can be applied to a textbox like so: text1.value = page.Request.ServerVariables ("SERVER_NAME")
Hope that helped.
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi Jason,
Yes what I'm looking for is to display the full http:// address that one sees in the browser address bar. I'm creating a very simple web browser and the address bar (Textbox) works fine but when I click on a page link to another link I would like to display the address in the same address bar. Will your second example work for this? And is there more to the code to do this then just putting your example to the textbox I have?
-- modified at 1:35 Saturday 4th February, 2006
|
|
|
|
|
... The second example will only work if you are working in Asp.net (thus providing a webpage to a client through a browser) as you are creating a "simple web browser" I am sure that the second concept will not function like you want.
When the user of your application clicks on a link within the document that you are presenting to them, why not just copy that link to your addressbar_textbox.value?
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi Jason,
After looking around I was able to find exactly what I was looking for. This is what I've got now that works really well.
'Make the Url_Address bar display the url your at.<br />
Private Sub AxWebBrowser_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser.NavigateComplete2<br />
URL_Address.Text = AxWebBrowser.LocationURL<br />
End Sub
Thanks for your help.
|
|
|
|
|
Hi. Is there a way to programmatically copy the contents of a .GIF (or .BMP) into the Clipboard directly from code?
Here is what I want to do:
1) use custom data markers (transparent GIFs) in Excel charts - scatter plot
2) copy contents of .GIF from within MS Access (or Excel) code and then "Paste"
onto/into my data series in Excel chart.
3) I want to avoid code in Excel so that I don't get "Enable macros?"
when I launch from Access (VBA code).
I have MS Access 2000 driving chart templates that reside in Excel (.xls) file. I can manipulate Chart Objects already from Access code, but still learning other "Excel" chart methods/properties.
Excel help says you can use a picture for a custom marker if you copy the image and then paste onto selected data series items - a MANUAL process.
Any help or direction would be appreciated.
Thanks,
Johnny
|
|
|
|
|
What you are looking for is called Excel Automation. Although I have not done exactly what you are talking about here, the Excel DOM (document object model) is extrmely robust, and most likly contains the functions to preform this programmatically.
To start, copy your source excel file, and record your "maunal" orocess as a macro. After stopping the macro, open the VBA editor, within excel, which will have a function that performs your "manual" process. Copy this function into your Access code base. Viola you are 90% done.
Lastly, you will have to create the excel object to run your external macro. A good example is found here: http://www.mvps.org/access/modules/mdl0006.htm[^].
The line discussing the create object code is what you really care about!...
Set objXL = CreateObject("Excel.Application")
Hope this helped
do you need to investigate an online backup[^] company
-- modified at 19:05 Friday 3rd February, 2006
Also take a look at:http://www.codeproject.com/com/ComExcelImages.asp[^]
|
|
|
|
|
Awesome! I totally forgot about (didn't even think of) using "Record Macro" and then see what went on.
Yes, you're right, that will get me the majority of what I need and then the rest is "left to student."
Thanks. (any others?)
Johnny
|
|
|
|
|
I want to show some data in an excel like grid. Is there a table control in vb6?
thanks,
sb
|
|
|
|
|
If I recall correctly, it is called a flex grid.
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi guys
I have a windows form with some textboxes, a datetimepicker, a checkedbox and a numericupdown, all of them binded to a bindingsource, when i add a new record (bindingsource.addnew()) a new row appears and the textboxes are empty (its OK), the datetime picker keeps the value from the previous record, and when i save the record (without modifying the datetimepicker), a new row is inserted but with null value in the datefield, the same happens for the checked box and numericupdown (they kkep the value from the previous record), and if they are not modified, a null value will be inserted.
I know i could assign a value to datetimepicker.value=now, and so on for the other 2 controls, but is there any way to insert records with the values on those controls (no matter if i changed them or not)?
Ive aldo tryed: bindingsource.resetbinding and bindingsource.resetcurrentitem, none of them does what i need
Thanks in advance
|
|
|
|
|
I can finially get the database file to copy where I want it too. But since file copying is a lengthy process I would like to show the user the progress of the file copy underway.
How can we task that to a ProgressBar control?
Code Sample:
Dim fs
Dim lngNumberChar As Long
Dim strPath As String
Dim strSourcePath As String
Dim strTargetPath As String
Dim strDbName As String
Dim strDbFileName As String
'set the target path for file coping
strTargetPath = drvList.Drive & "\" & strDefaultFolder & "\" & strDB
'set the path for making the Archive folder on the specified drive
strPath = drvList.Drive & "\" & strDefaultFolder
Set fs = CreateObject("Scripting.FileSystemObject")
'Retrive working database from INI file
strDbName = Space(256)
lngNumberChar = GetPrivateProfileString("Database", "strDBName", "", _
strDbName, 255, App.Path & "\Cosmo_VB.ini")
strDbName = Left(strDbName, lngNumberChar)
'Set the source path for file coping
strSourcePath = App.Path & "\" & strDbName
'Does the Archive folder exist on the specified drive?
If fs.FolderExists(drvList.Drive & "\" & strDefaultFolder) Then
'Yes, Overwrite the existing backup with the latest one
strDbFileName = Dir(strSourcePath)
If UCase(strDbFileName) = "COSMO_VB.MDB" Then
fs.CopyFile strSourcePath, strTargetPath, True
End If
Else
'Create the folder on the specified drive
fs.CreateFolder (strPath)
dirList.Refresh
dirList.Path = strDefaultFolder
strDbFileName = Dir(strSourcePath)
If UCase(strDbFileName) = "COSMO_VB.MDB" Then
'Copy the database file into the specified target path.
fs.CopyFile strSourcePath, strTargetPath, True
End If
End If
Quecumber256
|
|
|
|
|
Since the CopyFile method you're using to do the work doesn't (and will never) report back any progress, you can't really make a ProgressBar work. You'll never know how much progress has been made or how much is left.
There are several ways around this, none of them "simple".
1) Implement your own copy function. You'll have to get the file size, open the source file for Shared Read, read the contents in chunks, write them to the new file, and after every chunk, fire an event that notifies about the progress.
2) Use the Shell's File Copy function. This will show the normal copy operation dialog that you get when you drag and drop files in Explorer. The downside to using this is the user can cancel the copy. The upside is it does it's own ProgressBar.
3) Implement a ProgressBar that doesn't progress, but instead "spins". There is no 100%, but there is at least something to show that something is going on. See this[^] article on MSDN for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
This application was built with very novice users in mind. Therefore option 2 is the best bet. Can you point me in the proper direction for the Shell File Copy?
Thank you,
Quecumber256
|
|
|
|
|
Interesting development. I tried to use the FileCopy like this:
FileCopy strSourcePath, strTargetPath
I received this error Run time error '70' Permission denied. I'm assuming that because I have the source database open it won't allow me to copy it. Am I right?
Thank you,
Quecumber256
|
|
|
|
|
More than likely. The database is probably opened by the driver DenyShareAll, which means you can't get at it until the database is closed. That means all open connections must be closed before you can copy the .MDB file. Either that, or you don't have the proper permissions to write to the detination folder...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|