|
Hello everyone,
This is my first question to codeproject members. I hope everybody will help me.
I'm doing project in VB.net 2005 in windows form.
I designed forms
created database and table in SQLServer
Now I don't know how to connect this to window form.
How to write connection string, non-execute query.
Like VB6.0 whatever type in text box, listbox it should be inserted/updated in table column field respectively.
Plzzzzzzz help me.
Thanks in advance
Ashwini
|
|
|
|
|
For using database connectivity on .Net platform, Ado.Net is used. In simple words you will need to use DataSet, DataAdapter and DataConnction objects.
However I would recommend you to Google the ‘Ado.net’ and get a complete overview before using this, because concept of Ado.Net is different from Adodc which was used with Visual Basic 6.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hi
If you are Comming from vb6, then its not that Bad, but the logic of ADO in vb6 is Different from ADO.net, my Suggestion is to buy a Book in Beginning VB. you can get one in www.Murach.com.To google it helps but to a certain extent. sometimes you need a book to give you more info.
Hope this helps
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
In case if you want to see the syntax which will be used to implement database connectivity to TextBoxes, following is a small code snippet-
----------------------Code Start-----------------------------------------------
General Declaration-
Imports System.Data.OleDb
-----------------------------------------------------
Public Class Form1
Dim ds As DataSet
Dim con As New OleDbConnection("Put Connection String here")
Dim da As New OleDbDataAdapter("Select * from table1", con)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
da.Fill(ds, "Table1")
Me.TextBox1.Multiline = True
Me.TextBox1.DataBindings.Add("Text", ds, "Table1.field1")
End Sub
End Class
---------------------Code End-------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
hi i want to sort my datagrid when i clcick on any one of the header column name
i wrote teh code but that is not working
can some one please help me with this
Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles DataGrid1.SortCommand
Label13.Text = e.SortExpression
'lblWhatClicked.Text = "You clicked: " & e.SortExpression
Dim dv As New DataView(Eventds1.Tables(0))
dv.Sort = e.SortExpression & " DESC"
DataGrid1.DataSource = dv
DataGrid1.DataBind()
End Sub
Thank u
hepsy
|
|
|
|
|
Hi
when you drop a datagrid into your Form,and bind it to a datasource, it automatically sort the results with Columns , when you Click them. So you have messed around with you Settings. right click on your Datagrid and select properties. make sure that the "Allow Sorting" is Selected as true.
Hope it helps
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
That's true for Visual Studio 2005, not for 2002 or 2003.
|
|
|
|
|
IIRC, all you had to do to enable sorting on the DataGrid (not the DataGridView control) was set its AllowSorting property to True.
|
|
|
|
|
Hi everyone,
My question is how to download emails from a pop server and save them as *.eml or *.mht files to localdisk as oultlook does ?
Now what I know is that an .eml file can have images,attachments and all the e-mail formatting in it. So if I use a simple pop3 client to download message it will download the text part of the e-mail not full formatting - that's what I'm searching for!
I found this link : http://www.example-code.com/delphi/download-pop3-email-to-eml.asp but the library is not free or open source , can you find something like this , my dear friends ?
I also found another thing :http://www.developerfusion.co.uk/show/2453/
But It uses the winsock control which I can't found in VB.NET. Any one please help..
Thanks,
Dan
|
|
|
|
|
The file format has absolutely nothing to with a POP3 client. There is no file format specification for saving messages. The .eml format is specified by Microsoft and Outlook, not the POP3 protocol. It's also known as the message/rfc822 MIME type. You can find out everything about the format here[^], or just Google for "message/rfc822 format".
|
|
|
|
|
Hi Dave Kreskowiak,
Ok , Now I understood the real matter . Thanks for help. But Is there any way that I can use the winsock example that I showed you in the first post ? I tried but on every line I'm getting an error ! If you have any idea ... ?? :->
Thanks,
dan
|
|
|
|
|
The code you found was written for VB6, not VB.NET. It's possible to convert it. You'd have to add a Reference to the old Winsock control, I think it's in the list under the COM tab, Microsoft Winsock Control.
Dan`M wrote: I tried but on every line I'm getting an error !
I'd scrap the code and rewrite it using .NET Framework classes, but describing how those work is way beyond what you can fit in a couple of forum posts.
You're getting most of these error messages because you don't have a reference to the old Winsock control.
|
|
|
|
|
Hi,
I downloaded old winsock.dll from internet add added the reference. But i have still some errors.. Can you convert & post the code for VB.NET please ?:->
Thanks,
Dan
|
|
|
|
|
Dan`M wrote: I downloaded old winsock.dll from internet add added the reference.
Very big mistake. I already told you how to do it, and that didn't involve downloading a .DLL. The one you downloaded is also the wrong file!
Dan`M wrote: Can you convert & post the code for VB.NET please ?
I can't because my time is short. I do this for about 5 minutes, whenever I get a chance.
|
|
|
|
|
hi there
i am trying to develop an application similar to the laser game
I have tried many ways to deflect the laser beam (a line that i drew from a point to the mirror)
I am using a movable label control to repersent the mirror
any ideas on how to go about this problem???
Thanks
regards
Yasin
|
|
|
|
|
You should handle all drawing in a paint event handler. You just can't do it wth controls, not nicely. The deflection is basic physics. Which bit are you stuck on, drawng the line, or working out where it goes ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As I said before[^] forget the Label, it only complicates matters.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Forget the controls and rendering code for now. You haven't figured out how to represent your game's data properly yet.
The graphics you see in any game is a visual representation of the game's internal database. You can't possibly draw anything until you've got your data representation and management worked out.
|
|
|
|
|
Hi all,
I have an urgent question.
I am writing an windows service to retrieve files from a network drive mapped as Y: I get the following error... Could not find a part of the path "Y:\verify".
When I run an Application it works fine, so I tried to shell the exe from my service, but still get the error!
I have read and tried several things but to no success
Can anyone please assist me?
|
|
|
|
|
Have you tried the UNC e.g. instead of :
"Y:\somefile.txt"
Try (depending on the path):
"\\FredsComputer\C$\somefile.txt"
You always pass failure on the way to success.
|
|
|
|
|
Yes I have tried that, but the share needs authentication.
So I get access denied error
|
|
|
|
|
Sounds like a permissions/user issue.
I am not a networks expert and I guess someone else on this forum may be able to help.
Good luck...
You always pass failure on the way to success.
|
|
|
|
|
A Windows Service runs, by default, as the Local System account, which has no rights to any network resources. The service does NOT run under the user context. It runs as if a seperate user logged into the machine (actually it DOES login to Windows) with no network permissions.
To the service, there is no Y: drive. The only drives that exist are the local floppy, hard drive, and any CD/DVD drives.
If you want the server to have access to the network, you have to change the account it's running under to one that has network permissions. Click Start/Run and type services.msc . Find your service in the list and double-click it. In the dialog that shows up, click the LogOn tab to change the account.
|
|
|
|
|
Thanx for the reply.
I have tried that approach but maybe i'm doing something wrong?
I log in with a domain account, so in the service properties I
specify my logon details. But then I run the service it can still
not access my mapped drive
Got any idea why it would do this?
|
|
|
|
|
DO NOT CROSSPOST in multiple forums. It makes collaboration on an answer impossible.
Did you map the drive by hand yourself at any time or did a login script do it for you?? If it wasn't through a login script, then the service will not see the mapped drive because it hasn't mapped it itself.
Using mapped drives is a bit old-fashioned anyway. If you used UNC paths, you haven't have to worry about the mapping at all. The service still needs to run under a network account though.
|
|
|
|