|
Hi'
a file is created but it is not a picture format.
|
|
|
|
|
So, Let's start from Scratch
U have to set the datatype of this fiel is null because there is no way to
insert an image with other data. First u insert the other info in table and leave it null then update this row by sending the image.Remember 'FileContent' is the field name of Image. Data will be store in Binary Form and when u will retrieve it it will need space to store itself to be opened.
Here is the Code to Insert first.
AdoConne.Execute "Insert into DMSDOCCONTENTTRN (DOCUMENTCODE) values ('" _
& Trim(lbl_DocumentCode.Caption) & "')"
'Now send the Image or Any file in Binary Form.It will take some time depends upon the size of file so have patience.
Dim mFIlePath As String
Dim RstRecordset As New ADODB.Recordset
If RstRecordset.state = 1 Then RstRecordset.Close
RstRecordset.CursorLocation = adUseClient
RstRecordset.Open "Select * from DMSDOCCONTENTTRN Where DOCUMENTCODE = '" & (lbl_DocumentCode.Caption) & "'", AdoConne, adOpenDynamic, adLockOptimistic
Dim b
b = RstRecordset.RecordCount
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.LoadFromFile Trim(lvw_LoadFile.ListItems(Lint_LoopFile).Text)
RstRecordset.Fields("FILECONTENT").Value = strStream.Read
RstRecordset.Update
Now File has been store in Database Completely and First Phase is Completed.
Now u need to download it. So Wait I simplify the Code for U... Wait
|
|
|
|
|
For Downloding...
'Declare on Gen.DECLARATION
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'This line is also declared on Declaration with both,uploading and downloading
Dim strStream As ADODB.Stream
Dim RstRpt As New ADODB.Recordset
Set RstRpt = ModFncRecordSetReturnRst("Select FILECONTENT from DMSDOCCONTENTTRN" _
& " Where DOCUMENTCODE ='" & txtcode.text & "'")
If RstRpt.RecordCount > 0 Then
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.Write RstRpt.Fields("FILECONTENT").Value
DestinationFile = "C:\" & txtcode.text
strStream.SaveToFile (DestinationFile), adSaveCreateOverWrite
'FileCopy SourceFile, DestinationFile
SetAttr DestinationFile, vbNormal
Call ShellExecute(hwnd, "Open", DestinationFile, "", "C:\", 1)
'it will save it in C:\ and Open it from the C:\ Path
'In case of Any Trouble Ask me.
Take Care.
Bye.
Regards;
Ali
|
|
|
|
|
hi,
i have developed a client-server application in vb.net.
I am using a socket class in this application.
I have written the following code:
Dim wsTCP As New TcpClient
Dim nwStream As NetworkStream
Dim byt_Buffer() As Byte
Dim async_CallBack As AsyncCallback
Dim ipLocal As System.Net.IPAddress = IPAddress.Parse("MyIpaddress")
Dim wsTcpLst As New TcpListener(ipLocal, portno)
wsTcpLst.Start()
If wsTcpLst.Pending = True Then
wsTCP = wsTcpLst.AcceptTcpClient
wsTCP.Connect(ipaddress, portno)
nwStream = wsTCP.GetStream
byt_Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes("hello")
nwStream.BeginWrite(byt_Buffer, 0, byt_Buffer.Length, Nothing, Nothing)
wsTCP .close
endif
I am getting the error:
Only one usage of each socket address (protocol/network address/port)is normally permitted
at line wstcplst.start.
Please help me out at the earliest how this can be resolved.
Thanks in advance.
|
|
|
|
|
Some other application would appear to be already listening on the port you want to use. e.g. If you are listening on port 80 then you'll have to shut down IIS first (because it got there first)
|
|
|
|
|
how it can be done, from client application i am sending data server.
both are listening the same port which is required so that they will be able communication.
so how can i keep the port open at both end to listen.
how iis can be shut down.
Please elaborate.
thanks.
|
|
|
|
|
i think u should change the port name .
|
|
|
|
|
d_smita wrote: both are listening the same port
Then how do you test or use your application when the client and server happen to be the same machine?
You listen on one port and you send on another.
When you use IE to browse the web, IE sends data to port 80 of the server, but it listens on port 3xxx for a reply. Remember for any communications you need two end points - the end point on the client and the end point on the server.
Typically the server will be listening on a static port. This is necessary because clients have to connect with it some how. The client can use a variable port because it has the opportunity to communicate that with the server. It means that the client can also have multiple ports open to the server.
So, your client initiates the communication and opens a socket. The server will respond on that socket.
|
|
|
|
|
It's because you are doing a listen and a connect on the same port. If you have your app setup as a server then you are going to listen and accept and pass the handle off so that the server can listen for more connections. If you app is a client then you are going to connect to the server and start sending and or receiving data.
Look at some the client server tutorials on this site.
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Stop using URGENT! You have been warned at least twice. Either read the guidelines and comply or stop posting.
__________________
Bob is my homeboy.
|
|
|
|
|
Hi all,
Iam reading from an rtf file some data. i have managed to save them in an array textdata seperated by a comma. What is the fastest way to load data from this array to a sql table? kNowing that i might sometimes have multiple rtf files to read from .
|
|
|
|
|
samerh wrote: i have managed to save them in an array textdata seperated by a comma
What? Are you saying that you read a bunch of RTF (Rich Text Format) files and saved the text in an array? Left's see the code that did this.
samerh wrote: What is the fastest way to load data from this array to a sql table?
Keeping it simple, use an SqlCommand with a parameterized SQL INSERT statement and call this command for each element in your array. If I understand what you're trying to do correctly, you don't even need the array. Just read one file and insert it into the database, read the next, insert it, read, insert... See pattern here?
|
|
|
|
|
Iam new to VB.Net 2005 .I want to write a code such that whenever the user double-clicks on Datagridview the corresponding row values should be displayed in the relevant Textboxes.
I have typed as
txtecode.text=datagridview.item(columnindex,rowindex)
txtecode.text=datagridview.item(0,DATAGRIDVIEW.CURRENTROW.INDEX)
But it is showing error
Please give me the Code to display the data
Tahnk you in advance
|
|
|
|
|
hi,
Use this one at double click event of DatagridView
dim i as integer
i=datagridview.SelectedRows.Item(0).Index
' here 0 indicate first row from selected rows and rowno is store in var. i
txtecode.text=datagridview.rows(i).cells(0).tostring
' here i use first column of selected row(mean first row). u specify according to your requirement
Hope this Helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
I have a new blank web page in vb.net (Default.aspx), and I want to call a webpage design to appear in the same blank web page.Sort of a template.
I have the .css design already.Now how do I call it to appear in that vb.net webpage??
Please help
kagiso
|
|
|
|
|
|
The css only contains style for the design, you also need the html code for the design.
Paste the html in the body tag, and add a link tag in the head that uses the css file.
---
single minded; short sighted; long gone;
|
|
|
|
|
Still lost....say more
kagiso
|
|
|
|
|
matjame wrote: Still lost....say more
please...
|
|
|
|
|
What is it that you don't understand?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi all...
I have a datagrid with values bound to it from a table..I have a check box in every row of the datagrid.If i check the check box and click the delete button present in the form,the checked row of the datagrid should be deleted(ultimately deleting the data from the database table itself)..If i check all the rows in the datagrid and click the delete button ,all the rows should be deleted..Someone help me in this regard..
Sample code would do more help...
Thanks in Advance...
Balaguru
|
|
|
|
|
YOu need to delete the data on the table and then update the DataGrid.
See http://msdn2.microsoft.com/en-us/library/feh3ed13(VS.80).aspx[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
hi, maybe you can use the double click event of the datagrid. this is the scenario, if you double click your datagrid then a messege box will appear that saying if you want to delete the selected row.if yes then put your code to delete that record.that's my idea.
Don't block the drive way of all the newbies in programming.
|
|
|
|
|
85512698570@mobitel.com.kh
I have used above to send to sms to mobile phone, but it not work.
@mobitel.com.kh "Cambodia Mobile phone network"
85512698570 "Phone number"
Please help me
i get and error message "Mailbox unavailable" so it wrong with Receipient's Cellular Carrier or something else
Socheat
................
|
|
|
|
|
i have a dll .
i want to send that
can u tell me how to attach the dll with the thread?
Exactly The way u attached ur exe with the thread.
|
|
|
|