i'm doing a project on travel & tourism in vb.net...i've written a code for user login...but it shows some error "ret = com.ExecuteScalar()" in this line...pls can any1 help me out...
Dim com As New OleDb.OleDbCommand
Dim con As OleDb.OleDbConnection
Dim ret As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=E:\Ishu\Ishwarya\mini proj\travels.mdb")
com = New OleDbCommand("select count(*) from users where User Name='" + TextBox1.Text + "' and Password='" + TextBox2.Text + "'", con)
ret = com.ExecuteScalar()
If (ret > 0) Then
Dim frmobj As frmbc
Colin already answered your question but Im going to have to agree with him on the straight SQL, I just didnt want to say anything. Since you are using an Access DB you are going to have to validate the input to make sure that nothing that can lead to a SQL Injection attack is entered. First rule of user interactive programming is:
I'm using VB.NET 2005 Express, and I am reading in the contents of a text file.
I have declared:
Dim strLine as String
I'm using the StreamReader to read the contents of the text file, and I'm putting the contents into strLine.
Unfortunately, it only seems to read in the first 16381 lines from the text file, and processes those lines without any problems - but ignores lines beyond this. All my other test files (having far fewer lines than 16381) work fine.
On this occasion, the file that I need to read is 124415 lines long and so, as a novice, I've concluded that 'String' isn't up to the job.
Thanks for your reply.
I managed to solve the problem.
I had a Try ... Catch which was hiding the real problem - which was a problem with huge numbers I hadn't anticipated having to process. Simply changing the variables from Int to Long seems to have solved the problem.
The best way is to use properties to pass stuff back and forth, but you don't have to restrict yourself to properties you define. For instance, if you want to collect a chunk of text in the second form, you can code something like this, assuming you have a text box on the second form:
Dim MyString as string<br />
Dim dlg asnew FormTwo<br />
Dim result as DialogResult<br />
dlg.TextBox1.text = "Default Value"<br />
result = dlg.ShowDialog()<br />
If result = DialogResult.OK Then<br />
MyString = dlg.TextBox1.text<br />
' Some kind of error handling code<br />
End If<br />
I hav deployed my vb.net(Winforms)2005 application on client m/c through setup of my application.
In application's setup i hav added merge module CrystalReports10_maps.msm.
but when i m opening my crystal report through my application on client side machine it is asking for login id & password. My database is in mysql. I m giving the userid & password tht using in my application , but it says-> Logon failed.
Application is showing other forms but asking login only for crystal report.
Please help me.
If you don't want to be prompted for database credentials when you open the crystal report you should change the database connection (in crystal, under Database > Database Expert) to use integrated security as opposed to typing in the username / password.
Im using .Net 2, creating a user entry form.
How do I prevent 1 or more characters from being entered into a textbox.
For example: one textbox, I dont want a user entering slashes or single quotes.
In another textbox, I dont want the user entering single quotes.
Have I got to write a whole validation thing, or is there some sort of formatting or regex I can use?
I work with many projects (Visual basic 2005) that i use in many different solutions, but i have a problem with compiling the projects. I need to set the result dir of all my proyects with base on solution's dir. Ex:
I suggest not changing the target folders for the build binaries. Instead, go into the Project Properties, Build Events button, and create a Post-Build event that launches a batch file to copy the resulting files to where you need them.
:(Actually I created a form, which is a MDI.
I then took a form(form 2),which is a child form.
Now when i run the application the child form (form 2)
comes within the MDI.
But now the problem is how i can fix the child form
inside the MDI.
I tried the following code
when i double click the status bar the form size changes
so it moves within the MDI.Now how can i fix it ?.
I hav problem when i opened crystal report through my application on my client's machine.
i m using vb.net 2005 & mysql.
.net framework & connector required are already installed on my client machine, So application is runng all right.
but problem is only while opening crystal reports.
So i searched on net for help....Merge module shuld be included in project setup.
1)I have downloaded merge module "CrystalReportsRedist2005_x86.msm" & kept in my
"C:\Program Files\Common Files\Merge Modules" & have included it while building setup project.
2)it is necessary to include managed.msm file
& i m not getting this file
Anyone please help me.
Last Visit: 31-Dec-99 18:00 Last Update: 17-Aug-22 19:11