|
What is your question? Because the only thing we can see from this is that you spelled congratulations wrong.
|
|
|
|
|
how do i make the first connection with access
|
|
|
|
|
|
Other than you have no database code at all in this, there's already a bunch of things wrong with your code.
For instance, doesn't repeating this:
Me.UsernameTextBox.Text = ""
Me.PasswordTextBox.Text = ""
...
Username = ""
Password = ""
four times in this little code segment just scream "put me in my own method!"??
|
|
|
|
|
and how wouid i do that
please tell me how
|
|
|
|
|
have every location call this routine :
Private Sub ResetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetButton.Click
Me.PasswordTextBox.Text = ""
Me.UsernameTextBox.Text = ""
End Sub
example:
ResetButton_Click(nothing,nothing)
or
create a new routine and have every location call the new routine.
|
|
|
|
|
First, you'd pick up a beginners book on VB.NET. What you're missing is very basic stuff.
BUt, you do NOT call the Click handler to do this. You move the code to it's own Sub:
Private Sub ClearUsernamePasswordTextBoxes()
UserNameTextBox.Text = ""
PasswordTextBox.Text = ""
End Sub
Then the Click handler AND all your other place just call this sub to clear the boxes out:
ClearUsernamePasswordTextBoxes()
|
|
|
|
|
What you can possibly do is to connect to the data base using ADODB and create a loop which searchs for username and password in access file.
Private Sub SubmitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
With con
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open("db1.mdb")
End With
rs.Open("Select * from Table1", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
Dim pSn As Boolean
Dim uNme As String
unme = StrConv(UsernameTextBox.Text, VbStrConv.ProperCase)
rs.MoveFirst()
Do While Not rs.EOF
If unme = rs(0).Value And PasswordTextBox.Text = rs(1).Value Then
MsgBox("User name and Password Accepted", MsgBoxStyle.Information)
Me.Hide()
Form1.Show()
pSn = True
Exit Do
Else
rs.MoveNext()
pSn = False
End If
Loop
If pSn = True Then
ElseIf pSn = False Then
MsgBox("The username or password is incorrect. Please retype the Username and password.", MsgBoxStyle.Exclamation, "Login")
UsernameTextBox.Clear()
PasswordTextBox.Clear()
UsernameTextBox.Focus()
End If
End Sub
Parth Patel
|
|
|
|
|
Hi all
I have a MS Access Database which is Password protected
I want to connect to this particular database
Could u help me out how the connection string looks like
For eg:
I have given like this
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\Share\UpServer\TMSServer.mdb; Password=tmss"
But its showing me an error.
Could any one help me out
Thanks in Advance
|
|
|
|
|
If you provide details of the error, this will make it easier for people to provide assistance.
Paul
|
|
|
|
|
|
con.Provider = "Microsoft.Jet.Oledb.4.0"
con.ConnectionString = "Data Source = " & mdbPath & ";Jet OLEDB:Database Password=1234"
con.Open()
Shay Noy
|
|
|
|
|
Hi i am having an error message thrown when I wish to update my database. I call a sub procedure called Savechanges(which definately works because it is straight from a textbook and has been used in various projects I have done) for the rowChanged event of the datagridview which I am using to edit information. I might be calling saveChanges() to often but thats due to the fact that I don't know where to call savechanges for the datagridview? My datasets and adapters are all generated and I have looked at the select statement for the table adapter which has the problem and the select statement is correct. The datatypes are also correct for the various fields. Is there anywhere else I can check to see why the error is happening? Where should I call saveChanges for the datagridview for optimal performance? I am using VB.NET 2005 in a single user environment. thanks
Mr Oizo
|
|
|
|
|
Do you have a GUID on each row?
Sometimes if you don't have a GUID on a row it is not clear which record is being updated and the database update falls over.
You always pass failure on the way to success.
|
|
|
|
|
G.....I have never heard of a GUID. How would I put one on each row? I'll try search on the net so long tho. Thanks
Mr Oizo
|
|
|
|
|
A GUID is a "Globally Unique Identifier". Basically a 128-bit number used to identify objects. A GUID is a bit too "heavy" for a database key.
Read up on "Primary Key[^]".
|
|
|
|
|
Not so much a GUID, but a Primary Key for each record in the table is REQUIRED to use the Adpaters.
|
|
|
|
|
the table is a table called "SONG". In this table for each song listed is a unique (autogenerated number) field called "SongID". This table also has many to one relationship with a table called "GENRE"(One genre can have many songs) and another many to many relationship with a table called "CATEGORY"(a song must belong to one or more categories and a category consists of many songs). Anyway these relationships are defined in the access database and automatically in the .xsd file for my solution. (Genre table has a primary key named "genreName" which is also a foreign key in the table song) this is all correct as far as I know. At the moment I am only running updates for the fields in the song table which is theoretically a child table of both CATEGORY and GENRE. What might the problem be?
Mr Oizo
|
|
|
|
|
Okay - there is the issue.
You mentioned Access database - well you need a unique index in order to be able to update a table in Access - or at least I always have needed on with Access databases and VB .NET .
I mentioned GUID as it is the easiest way of ensuring you have a completely unique key - actually I have come across non unique GUIDs in my career.
For a less heavy option, GUIDS can take space in your table, you could create a composite key i.e. a key made up of multiple fields such as artist, album and songname.
However you could still have issues which is why in my opinion if space is not an issue a GUID is very useful.
You always pass failure on the way to success.
|
|
|
|
|
Thanks for the reply....My song table does have a unique ID. It is an autonumber sequentially generated field named songID. Do I need to manually write an update statement to update the database? I thought the autogenerated statements would be fine? My table adapters and datasets are all auto generated and my datagridview uses the SONG table as its DataMember. I would of thought that all i need to do is update the fields in the datagridview and then record the changes back to the database? By using
Public Sub SaveChanges()<br />
<br />
'this Sub is responsible for recording changes back to the database<br />
<br />
Dim dsUpdates As dsLibraryNewest<br />
<br />
Try<br />
dsUpdates = CType(DsLibraryNewest.GetChanges(), _3rdYearProject12Aug.dsLibraryNewest)<br />
<br />
If Not (dsUpdates Is Nothing) Then<br />
'these are various adapter for the six various tables <br />
modbdaSongNewest.Update(dsUpdates)<br />
modbdaCategoryNewest.Update(dsUpdates)<br />
modbdaGenreNewest.Update(dsUpdates)<br />
modbdaAlbumNewest.Update(dsUpdates)<br />
modbdaCategorySongNewest.Update(dsUpdates)<br />
modbdaAlbumSongNewest.Update(dsUpdates)<br />
<br />
<br />
DsLibraryNewest.AcceptChanges()<br />
End If<br />
<br />
Catch ex As System.Exception<br />
<br />
' MessageBox.Show(ex.Message, "Error", _<br />
'MessageBoxButtons.OK)<br />
<br />
End Try<br />
<br />
End Sub
Mr Oizo
|
|
|
|
|
As far as I know you do need to write an update query as the Access table is not bound to the dataset.
What happens in creating a dataset is that VB takes a copy of your Access table and displays this copy.
Here is a link[^] to a good example of how to update an access database.
I hope it helps.
You always pass failure on the way to success.
|
|
|
|
|
greetings to you all,
guys i need your help very badly.. on how to create a dynamic textbox object in runtime... using VB.NET 2005
the code below suppossedly can display 5 textbox,
but sad to say i cannot see any textbox in my form.
Can someone help me on this:
For xcnt = 0 To 4
Dim text As New TextBox
text.Visible = True
text.Location = New Point(33 + xcnt, 27)
text.Size = New Size(104, 21)
Next
pls help here... thank you so much....
links/codes are highly appreciated..
-- modified at 6:21 Monday 24th September, 2007
start a new beginning in every ending; thats what life for......
|
|
|
|
|
Main problem is that you are not adding text boxes to Forms control collection.
Try following code –
--------------------Start Code---------------
Dim xcnt As Integer
Dim x As Integer
x = 20
Dim txt As TextBox
For xcnt = 0 To 4
txt = New TextBox
Me.Controls.Add(txt) ‘you were missing this line
txt.Location = New Point(33 + x, 27 + x)
x += 25
Next
-------------------Code End---------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
thank you sir dave, your help is very highly appreciated..
looking forward to you soon, many thanks..
start a new beginning in every ending; thats what life for......
|
|
|
|
|
hi,
how to convert Byte to IntPtr ?
Thanks & Regards
|
|
|
|