poojavb 29 Junior Poster

hi i am having problem in deleting a single row from a gridview. i am using binding navigaator to delete the row. i have customer table and booking table. Cust_id is used as foreign key in booking table. when i try to delete a single row from booking table it delete all the bookings related to that customer in the gridview.It also deletes the related customer aswell. i just want to delete one booking of that customer

Me.Validate()
Me.CustomerBindingSource.EndEdit()
Me.CustomerTableAdapter.Update(NewBookingDataSet.Customer)
Me.BookingBindingSource.EndEdit()
Me.BookingTableAdapter.Update(NewBookingDataSet.Booking)


if i use the above coding under a button than i get the following error but if i use the same code under binding navigator save_item it works fine..here is the error which i get when used under button

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Booking_Customer". The conflict occurred in database "photoshoot", table "dbo.Customer", column 'Cust_id'.
The statement has been terminated.

ur booking table must be having a primary key right?? guess booking_id

one thing u can do is...

take a text box and make it visibility as false

when the user will click on the datagrid the booking id shud be inserted in the textbox and then on the delete button add the code to delete the booking id as it is in the text box....

'code to get the bookingid from datagrid
'code should be wriiten in the cell click event of datagrid

Dim i As Integer
             i = datagridView1.CurrentRow.Index
        textbox1.text= datagridView1.Item(0, …
poojavb 29 Junior Poster

why did you create an exe file in the first place? do you have issues with non-Windows OS? :)

Let me explain in detail....

Actually the software was created some 4-5 years ago and now it is having some error....

when a patient is registered a folder gets created with patientname and date....and the details of the patient that are stored in the database also gets stored in the textfile....

In case if there is a database crash these text file help to retsore the database....

but now the issue is if suppose the database is crashed and there is a patientfolder which dont have the textfile in it or may be the textfile is there but empty...the database will stop retrieving value after that patient....

so I want to trace the patient which shows the error...

since it is not possible to open each and every folder and check if the textfile exists in the patient folder as there can be more than 300 to 500 patients...

hope u understood the issue...

so I need to create a jar file that will track the patient which will show this error...

poojavb 29 Junior Poster

System messages => bad idea
Logger messages => good idea (example slf4j)

Yes but the software is already created and distributed to customers and is having some problems.

Since the software cannot be replaced we need to so something so that the software is as it is and we can also find the error.

poojavb 29 Junior Poster

well bernardz26! there are two simple ways to perform this , one is to declare a global or public variable and just access it at any part of your prog , and second way is to call the form then the call the control , here are both ways to perform this operation ,

'declare the public variable
public mynumber as int
 'now assign the value of first textbox of form1 to it .
'use this at the text change event of the textbox
mynumber = val(textbox6.text)
'now place this code at the your form two at any event where you want to sum both values of textbox6 of form1 and textbox6 of form2
textboxResult.text = val(textbox6.text)+mynumber
'this will show the result and sum both textbox values

now there is another way to perform same operation .

'use this code where you want to sum both values
textboxResult.text= val(form1.textbox6.text)+val(textbox6.text)

this will also perform same operation , hope this will solve your prob ,if your prob is solve then please dont forget to mark this thread solve ,

Regards

we can also use the CInt instead of Val or the Integer.Parse method

Jx_Man commented: Right. Val is vb6 function. +14
poojavb 29 Junior Poster

Hi,

I have a form in VB which is scrollable (using autoscroll) and when I currently click
'print', it only prints what I can see; it takes a screenshot of the viewable information. Here's my code:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim settings As New System.Drawing.Printing.PrinterSettings

        sPrintForm.PrinterSettings = settings
        settings.DefaultPageSettings.Landscape = True

       sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview

       sPrintForm.Print()
    End Sub

Could somebody please show me how to print the whole of the page, including the areas that can't be seen?

Thanks in advance :) (See attached file for image)

The Print form control is there in the Visual Basic PowerPacks toolbox

To print the complete client area of a scrollable form
1.In the Toolbox, click the Visual Basic PowerPacks tab and then drag the PrintForm component onto the form.

The PrintForm component will be added to the component tray.

2.In the Properties window, set the PrintAction property to PrintToPrinter.

3.Add the following code in the appropriate event handler (for example, in the Click event handler for a Print Button).

PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)

Try once

poojavb 29 Junior Poster

Hello Friends,

I have one project in Java but the exe file cant show the system.out.println messages.

I want to create a jar file in such a way that the error of file e.g. abc.java should be viewed when I click the jar file.

is there any possible way....

poojavb 29 Junior Poster

I build my project then I open the EXE file at the RELEASE FOLDER, when generating in a crystal report a error message pops up "LOAD REPORT FAILED".

Check the path for the crystal report or paste the crystal report code u have written

poojavb 29 Junior Poster

Hello Friends....

I have a patient registration form in my project...in which I have to browse the image of the patient save it in the database and when I need the details of the patient again the uploaded image should also be displayed....

Please help me in this...

I have created a column in database which will save the filename and path of the image but I dont know as to how to call the image again for displaying purpose....

Got it solved

PictureBox1.Image=Image.FromFile("FileName")
poojavb 29 Junior Poster

Hello Friends....

I have a patient registration form in my project...in which I have to browse the image of the patient save it in the database and when I need the details of the patient again the uploaded image should also be displayed....

Please help me in this...

I have created a column in database which will save the filename and path of the image but I dont know as to how to call the image again for displaying purpose....

poojavb 29 Junior Poster

Post your code here or try something like below

Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
        If ListBox1.SelectedItem.ToString.Length > 0 Then
            Process.Start("explorer.exe", ListBox1.SelectedItem.ToString)
        End If

Hey thanks Friend....got it solved

Try
            Dim path As String
            Dim abc As String = lstFiles.SelectedItem.ToString
            path = (Application.StartupPath & "\" + lblPattName.Text + lblPatientID.Text + "\" + abc).ToString
            Debug.Print("path in doc: " + path)
            Dim extension As String = IO.Path.GetExtension(path)
            Debug.Print("extension: " + extension)
            If extension = ".doc" Or extension = "docx" Then
                Process.Start("winword.exe", path)
            ElseIf extension = ".pdf" Then
                Process.Start("AcroRd32.exe", path)
            ElseIf extension = ".bmp" Or extension = ".jpeg" Or extension = ".jpg" Or extension = ".gif" Or extension = ".png" Or extension = ".ico" Then
                Process.Start("mspaint.exe", path)
            ElseIf extension = ".txt" Then
                Process.Start("notepad.exe", path)
            End If
        Catch ex As Exception
            MsgBox("Error")
        End Try
poojavb 29 Junior Poster

You are loading the full path of files into list box right? Then in selected index changed event of list box read the file path and load the file using Process.Start("explorer.exe", Filepath)

When the selected index gets changes it just opens the windows explorer every time....

and not the file...

poojavb 29 Junior Poster

I am able to open all kinds of files using above code, Provided you have the file readers installed in machine..

But how shud I link it with the filenames....

the filename in the list box are dynamic....

so I will I link it the the list box

and where shud the code be written

poojavb 29 Junior Poster

You can read out the file names into listbox but not sure windows app supports file location as hyperlink

Yes I have done this now....

Try
            lstFiles.Items.Clear()
        Dim di As New IO.DirectoryInfo(Application.StartupPath & "\" + lblPattName.Text + lblPatientID.Text + "\")
        Debug.Print("di: " + di.ToString)
        Dim diar1 As IO.FileInfo() = di.GetFiles()
        Dim dra As IO.FileInfo
        'list the names of all files in the specified directory
        For Each dra In diar1
            lstFiles.Items.Add(dra)
        Next
        Catch ex As Exception
            MsgBox("Select Patient Name")
        End Try

but I dont know how to link these files.... :(

poojavb 29 Junior Poster

Hello Friends,

I have got confused with one topic

Scenario is such that....

I need to browse a file and copy the file from one location to another....

I am done with the file copying but I need to add the list of all files present under that folder in a control( dont know which control to use) and it shud be a link....so that when the user clicks that link it should open the file with that reader...

Suppose a pdf file shud be opened by the pdf reader...

Similarly I need to access
-> pdf
-> any image file
-> text file

Can anyone help me in this?

poojavb 29 Junior Poster
Dim cmd As OleDbCommand = New OleDbCommand("SELECT username,password FROM tblUsers where username=? and password=?", conn)
        Dim usernameParam As New OleDbParameter("@username", Me.txtUsername.Text)
        Dim passwordParam As New OleDbParameter("@password", Me.txtPass.Text)

        cmd.Parameters.Add(usernameParam)
        cmd.Parameters.Add(passwordParam)
        Try
            connectDatabase()
            Dim read As OleDbDataReader = cmd.ExecuteReader()
            If read.HasRows Then
                read.Read()
                If txtUsername.Text = read.Item("username").ToString And txtPass.Text = read.Item("password").ToString Then
                    MsgBox("Login successful")
                    frmMenuAdmin.Show()
                    Me.Close()
                Else
                    MsgBox("Login unsuccessful, username and passwords are case sensitive")
                End If
            Else
                MsgBox("Login unsuccessful")
            End If
            read.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            DisconnectDatabase()

        End Try
Dim read As OleDbDataReader = cmd.ExecuteReader()

< < < error here saying No value given for the one or required parameters

pls help

Please check ur select query it has twice username=? written in it....

poojavb 29 Junior Poster

Hello Friends,

I have a patient register form in my project...

When the patient details will be saved in the database it should also be saved in the text file...

I am dynamically creating a folder with patientid and firstname

in that folder I am creating a text file patientreg.txt and it should contain the contents of text file....

I have wriiten the below code but I am getting an error....

Dim di As DirectoryInfo = New DirectoryInfo(Application.StartupPath & "\" + txtPatientID.Text + txtFName.Text)
If Not di.Exists Then
   di.Create()
End If
Dim pathreg As String = di.ToString & "\patientreg.txt"
If File.Exists(pathreg) Then
   Debug.Print("True: " + pathreg)
Else
   File.Create(pathreg)
   Debug.Print("False: " + pathreg)
End If
FileClose()
'Dim objWriter As New System.IO.StreamWriter(pathreg, False)
'objWriter.WriteLine(txtPatientID.Text + "*" + txtFName.Text)
'objWriter.Close()
IO.File.AppendAllText(pathreg, txtPatientID.Text + "*" + txtFName.Text)
Debug.Print("di value: " + di.ToString)

Error: The process cannot access the file 'D:\Pooja\CM\Clinical_Management\Clinical_Management\bin\Debug\435sdfs\patientreg.txt' because it is being used by another process.

Can anyone help me out in this...I also added the code to close the file...but still the error is throwing up....

Got the answer

Dim di As DirectoryInfo = New DirectoryInfo(Application.StartupPath & "\" + txtPatientID.Text + txtFName.Text)
If Not di.Exists Then
    di.Create()
End If
Dim pathreg As String = di.ToString & "\patientreg.txt"
FileOpen(1, pathreg, OpenMode.Output)
If File.Exists(pathreg) Then
    Debug.Print("True: " + pathreg)
Else
    File.Create(pathreg)
    Debug.Print("False: " + pathreg)
End If
Print(1, txtPatientID.Text + "*" + txtFName.Text)
poojavb 29 Junior Poster

Hello Friends,

I have a patient register form in my project...

When the patient details will be saved in the database it should also be saved in the text file...

I am dynamically creating a folder with patientid and firstname

in that folder I am creating a text file patientreg.txt and it should contain the contents of text file....

I have wriiten the below code but I am getting an error....

Dim di As DirectoryInfo = New DirectoryInfo(Application.StartupPath & "\" + txtPatientID.Text + txtFName.Text)
If Not di.Exists Then
   di.Create()
End If
Dim pathreg As String = di.ToString & "\patientreg.txt"
If File.Exists(pathreg) Then
   Debug.Print("True: " + pathreg)
Else
   File.Create(pathreg)
   Debug.Print("False: " + pathreg)
End If
FileClose()
'Dim objWriter As New System.IO.StreamWriter(pathreg, False)
'objWriter.WriteLine(txtPatientID.Text + "*" + txtFName.Text)
'objWriter.Close()
IO.File.AppendAllText(pathreg, txtPatientID.Text + "*" + txtFName.Text)
Debug.Print("di value: " + di.ToString)

Error: The process cannot access the file 'D:\Pooja\CM\Clinical_Management\Clinical_Management\bin\Debug\435sdfs\patientreg.txt' because it is being used by another process.

Can anyone help me out in this...I also added the code to close the file...but still the error is throwing up....

poojavb 29 Junior Poster

did u drop the dataset first on the form and than used this coding under the textbox which u used for the search. i m just confused about the result display.where your query is going to display the result..is it a gridview where u will be displaying the result?

Yes the result will be displayed in the datagridview....

no need to drop the dataset on the form....

poojavb 29 Junior Poster

When Creating a query using the sear Criteria Builder . I keep getting the error :

" The schema returned by the new query differs from the base query "

I no this means that the error is due to the query attempting to return too little columns

i have 3 rows in a table but i want to display one.

i am currently using a list box what alternative is there

Thanks

Try to provide some code so that we can help u....

poojavb 29 Junior Poster

hi every 1 i am trying to make a search criteria based on last name.i have dragged and dropped customer dataset as details view on my form and booking as gridview(customer id is foreign key in bookings table so now when i scroll through customer i could see the relaive booking history in grid view.). now i have many customer so i have to scroll down to look for a particular customer. i want to create a textbox where i can enter customer's last name and it should change the data of details view from current customer to the customer which is searched and also should change the related data in gridview aswell which is customer booking data.really need help plz..provide code if u can..here is wat i have done but no luck.

Dim ds As DataSet
'** means:
'check for correct name of the table in dataset, you can still use index like [0] if this is 1st or only table in dataset


'class variable where you have all the data of customers and its bind to datagridview
Private Sub DoTheFiltering()
Dim filter As String = txtCustSearchNewBooking.Text
Dim query As String = "LastName like '%" & filter & "'"
Dim rows() As DataRow = ds.Tables("Customers").Select(query)
'**
Dim tableNew As DataTable = New DataTable("SelectedCustomers")
'create columns for table:
For Each column As DataColumn In ds.Tables("Customers").Columns
tableNew.Columns.Add(New DataColumn(column.ColumnName, GetType(System.String)))
Next
'adding rows to table:
For …

poojavb 29 Junior Poster

i had to take someone elses project this year because i failed to complete my project,however im having troubles with the one i picked up.i cant even change it now because ive already submitted synopsis and software engineering journal on that new project.its on gymnassium system.

the main form had the text : Main_frm:Developed by John Fernandes
i deleted Joh Fernandes and entered my own name in the text properties of the main form.
when i run the project,the main form opens up with all its tabs.and with my name.but when i select a tab and open another form like coach form,the old name ie John Fernandes appears back again.how should i make sure this doesnt appear again?

U must be having the source code right so search the entire project source code with the name and try to find out...else try the project properties also....

poojavb 29 Junior Poster

hello!
i think it is not possible in mssql server , you can open it even when your software is running . this is what i think , so dont lose hope , if you find any solution please post it here for others .

Regards

it is for *.mdb file....
Microsoft Access

poojavb 29 Junior Poster

Hello Friends,

I have compeleted my project but I just need one help....

I want that when the application exe file is running at that time the database associated with the application shud be closed....

Means...I am using the .mdb file...

is there any way that when the application starts, if the user has opened the .mdb file then it shud be closed and also that when the application is running no one shpuld be able to open the .mdb file....

Please just let me know if its possible...

Thanks in advance

poojavb 29 Junior Poster

Thanks that really helped, it is working now. Much appreciated

Mark the thread as solved if it helped u....

poojavb 29 Junior Poster

The zip file is not opening....

When the download box comes and I save the file...its takes a lot of time and finally in between the download completes and the zip file does not open....

I tried downloading in many machines....

Got it solved

poojavb 29 Junior Poster

Hello , I am doing a project on Resort Website where I have a module of Room Reservation. I want a code for checking the availability of rooms when user selects arrival date and departure date and clicks check button.

database
room_details table
------------------
roomno
type
rate_regular
rate_delux
rate_suite
--------------------

room table
----------
roomno
custid
check_in_date
check_out_date
no_of_room
no_of_members
room_type
room_status

Try this out

select rt.roomno from room rt, room_details rd where rt.roomno-rd.roomno and (Format([rt.check_in_date], 'MM/dd/yyyy')) not between 'Selectdate' and 'Selectdate' and (Format([rt.check_out_date], 'MM/dd/yyyy')) not between 'Selectdate' and 'Selectdate'

'SelectDate will be the date selected by the user....
poojavb 29 Junior Poster
I m trying to make totaly disable mdi child form1 when another data entry form2 opened. Bcz by mistak on clicking frm1 frm2 go to back that i dont want to do.

Me.enabled=false and frm1.sendto back.
can't solve the problem.

Use this

Me.Hide() or Me.Visible=False
Form2.show()

you can use the hide or visible=false option

poojavb 29 Junior Poster

hello !
try this may be this will solve your prob

dim con as new sqlconnection("connectionstring")
con.open()
dim da as new sqldataadapter("select firstname,lastname,address from table where firstname='" +txtfirstname.text+"' and lastname='"+txtlastname.text +"' and address='"+ txtaddress.text+"'",con)
dim dt as new datatable
da.fill(dt)
if dt.rows.count = 0 then
'means record is not in db , you can save
else
'record is already in db , so dont save
end if

this is not the ideal solution as i think this thing make your program slow ,but it will solve your prob .
if your prob is solved then please mark this thread solved .

Regards

U can also use a datareader instead of datatable....

if the reader returns true means the data is present so do not insert....else insert

Try
                Dim myCommand As OleDbCommand
                myCommand = New OleDbCommand("your sql query", Connection)
                Dim reader As OleDbDataReader = myCommand.ExecuteReader
                if reader.read=True
                 MsgBox("Data already exists")
                else
                 'insert the data
                reader.Close()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
marcmanlin2 commented: thanks i got it. +0
poojavb 29 Junior Poster

i am so confuse dude..

why in my visual studio 2010 ultimate didn't show crystal report gallery?

after i click "add new item" and add crystal report, it just show me SAP page that say "learn and download".
i have install SAP crystal report runtime engine for .NET framework 4(32-bit).

i'm new to this thing, please guide me dude :(

thanks in advance..

Crystal report runtime is usefull in runtime not for creating crystal reports...

u need to install the crystal reports exe file first so that u will be able to create reports...when u install the crystal report software u will also get the runtime installer with it....

Download the 288MB package from the link learn and download and install it...

poojavb 29 Junior Poster

example iam the employee and i want to have a vacation leave and i want to have a vacation in 4 days and the vacation leave have 10 days maximum so if i get 4 days my vacation leave will be 6 days automatically

then on my another vacation i want to used again my vacation leave and i want to acquired 3 days so my vacation leave will be 3 days left automatically

here`s my problem sir...i cant get the total value of my first transaction to my available days
example 10 is the available and i used 3 so my left days is 7
on my another transaction the available days was 10 again which is wrong
10 - 3 = 7 first transaction
7 - 2 = 5 second transaction

please help me T_T

Try this

select  DateDiff("d",(Format([FromDate], 'MM/dd/yyyy')),(Format([ToDate], 'MM/dd/yyyy'))) from Tablename
poojavb 29 Junior Poster

Hey guys!

I need a little help with Crystal Reports!The Report keeps repeating the details.I tried to group it by the reference number but it keeps displaying it four times!Also how can I order the report by reference number?Please help me its the last thing for me to finish my software!Here's my code:

Dim crptdoc As New CrystalReport1
        Dim mystr As String
        Dim myDS As New DataSet1

        crptdoc.Load("C:\Users\ACP\Documents\Visual Studio 2005\Projects\Sistema ManoObras\SistemaManoObras\SistemaManoObras")
        crptdoc.SetDataSource(myDS.Tables("Payroll"))

        mystr = "{Employees.EmployeeID} = " & Val(Form1.TxtEmpID.Text) & "and {Payroll.PayrollID} = " & Val(Form1.TxtPayrollID.Text) & ""
       
 CrystalReportViewer1.SelectionFormula = mystr
        CrystalReportViewer1.ReportSource = crptdoc

[icode]
[/QUOTE] 

Try out this


[code]

[code]

'Import
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

'Form Load event
      Dim cryRpt As New ReportDocument
        cryRpt.Load(Application.StartupPath & "\Reports\CRBill.rpt")'ur crystal report path goes here

        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        crParameterDiscreteValue.Value = frmMain.dtpFromBill.Value.ToString("yyyy-MM-dd")
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("fromdate") 'the red one is the paramenter name I have created
        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)


        crParameterDiscreteValue.Value = frmMain.dtpToBill.Value.ToString("yyyy-MM-dd")
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("todate")'the red one is the paramenter name I have created

        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

        crParameterDiscreteValue.Value = frmMain.txtPatName.Text
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("patname")'the red one is the paramenter name I have created

        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

        crvBill.ReportSource = cryRpt
        crvBill.Refresh()

[/code]
u can set the selection formula in the crystal report itself....

First create the parameters that u need and then right click on the cystal report for report-> selection formula->record

mention the criteria in …

M.Waqas Aslam commented: unnecessary code,with out knowing the prob. -1
poojavb 29 Junior Poster

I'm new to Visual Basic and I am trying to set up a currency converter. I have converted a currency to UK Sterling on the first form and on the second form I want to have the same label with the same amount of UK Sterling as on the first form on the second form. Please help!

'Form1 code goes here

Label1.Text= 'Currency amount
form2.Label1.Text=Label1.Text 'This statement can be written in form2 load event as below
'Form2 load event

Label1.Text=form1.Label1.Text

Hope this helps u

poojavb 29 Junior Poster

Hello,

currently, what i want to do is, add a column in a table "default" during runtime. Well, I've got that covered already.

The problem is, the column names are actually taken from the users input through a textbox or drop down list and of course, if the same column is added already in the table, it generates an error since it has to be unique.


That is why i wonder if it is possible to know if a column already exists without viewing the form which contains the grid view of that table?


Thanks if you can help :$

What u can do is....

before inserting the value into database u need to check if the value exists in the table
using the select query

"select colname from tablename where colname="'+textbox1.text+"'"

If the reader returns a true value then u shid not save the value in the database instead show a msg box that value already exists...

else save the value in database....

hope it helps u...

for eg...

Try
             Dim myCommand As SqlCommand
            myCommand = New SqlCommand("select  colname from tablename where colname='" + Textbox1.Text + "'", Connection)
            Dim reader As SqlDataReader= myCommand.ExecuteReader
            If reader.Read = True Then
              MsgBox("Input already exists")
            Else
               'Save query goes here
            End If
            reader.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

u can also add the distinct keyword in the select query.... and also u can code for ignore case

poojavb 29 Junior Poster

Amazing....

[Container] fixed the problem ---- THANKS!!

Just want to make sure I understand what you are saying... Container is a reserved word that can be used in SQL "UPDATE" statement?

U have missed the "+" sign in ur update query
Try this...

Try
                    Dim MessageText As String
                    Dim myCommand As OleDbCommand
                    myCommand = New OleDbCommand("UPDATE MaxTime SET Container = '"+txtMaxContainerTime.Text+"', Vehicle = '"+ txtMaxVehicleTime.Text+ "', Exterior = '"+ txtMaxExteriorTime.Text+ "', Interior = '"+txtMaxInteriorTime.Text+ "'", dbConnection)
                    myCommand.ExecuteNonQuery()
                    MessageText = "Information Updated Successfully !! "
                    MsgBox(MessageText)
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
kingsonprisonic commented: Read the post carefully then argue. You are confusing the OP.... -1
poojavb 29 Junior Poster

I would like to retrieve the ID number for that row that was just inserted into the database.

Dim Enrollment As New Enrollments  
        With Enrollment  
            .Student_ID = CInt(lvwStudents.FocusedItem.Text)  
            .Enrollment_Date = CDate(dtpDate.Text)  
        End With  
        EnrollmentBAL.Save(Enrollment)

I have this code to save it from the database, what I want to do is after saving it I want to get the value of its ID and pass it to another table. can anyone help me on how to this or whats the best way to this. Thanks

try this

select last(id) from tablename
poojavb 29 Junior Poster

The has part was just my logic on the sql i want to acquire. :) Ill try that now..

If it helps u mark the thread as solved :)

poojavb 29 Junior Poster

I want to Have a Fix File path for my Flash Animation Flash Screen..

Is this possible ?coz VB doesnt allow you to upload a Flash File In resources...


This is my path:
AxShockwaveFlash1.Movie = "C:\Users\Nat\Desktop\Sudoku tactics(Pencil)\finished products\SPLASHscreen.swf"

It's not fixed...If you switch PC it wont work anymore...

Try it add it in the debug folder of ur project in a folder and then give the path as

Dim path as String
path=(Application.StartupPath & "\foldername\filename")
poojavb 29 Junior Poster
Select  TRANSACTION.TRANSACTION_ID ,CUSTOMER.FNAME ,CUSTOMER.LNAME,PET.PNAME,Employee.Emp_ID,Employee.fname,TRANSACTION.DATESTART,TRANSACTION.DATEEND 
                    from(TRANSACTION) 
       
                  INNER  JOIN CUSTOMER
                   ON TRANSACTION.CUSTOM_ID = CUSTOMER.CUSTOM_ID
                   INNER JOIN PET
                   ON TRANSACTION.PET_ID = PET.PET_ID    
                   INNER JOIN EMPLOYEE
                   ON TRANSACTION.EMP_ID = EMPLOYEE.EMP_ID
                   Where TRANSACTION.STATUS=1 
                    order by TRANSACTION.TRANSACTION_ID

Cant edit my code. This is my code. I forgot to remove repeted Transaction.EMP_ID

I have tried the below using my tables where

your transaction table is my appointment table
remaining tables are patientreg,doctorregister,treatmentmaster

See the below code...it worked fine for me...

SELECT appt.ApptID,(dr.DoctorID+ " has " +dr.firstname) as Title, tmt.TreatID, pt.PatientID
FROM patientreg AS pt INNER JOIN (treatmentmaster AS tmt INNER JOIN (doctorregister AS dr INNER JOIN appointment AS appt ON dr.DoctorID = appt.DoctorID) ON tmt.TreatID = appt.TreatmentID) ON pt.patientid = appt.PatientID
WHERE (((appt.PatientID)=[pt].[patientid]) AND ((dr.DoctorID)=[appt].[doctorid]) AND ((tmt.TreatID)=[appt].[Treatmentid]));
poojavb 29 Junior Poster
Select  TRANSACTION.TRANSACTION_ID ,CUSTOMER.FNAME ,CUSTOMER.LNAME,PET.PNAME,Employee.Emp_ID,Employee.fname,TRANSACTION.DATESTART,TRANSACTION.DATEEND 
                    from(TRANSACTION) 
       
                  INNER  JOIN CUSTOMER
                   ON TRANSACTION.CUSTOM_ID = CUSTOMER.CUSTOM_ID
                   INNER JOIN PET
                   ON TRANSACTION.PET_ID = PET.PET_ID    
                   INNER JOIN EMPLOYEE
                   ON TRANSACTION.EMP_ID = EMPLOYEE.EMP_ID
                   Where TRANSACTION.STATUS=1 
                    order by TRANSACTION.TRANSACTION_ID

Cant edit my code. This is my code. I forgot to remove repeted Transaction.EMP_ID

Try this code

Select  TRANSACTION.TRANSACTION_ID, CUSTOMER.FNAME, CUSTOMER.LNAME, PET.PNAME, Employee.Emp_ID, Employee.fname, TRANSACTION.DATESTART, TRANSACTION.DATEEND 
from (TRANSACTION INNER  JOIN CUSTOMER
                   ON TRANSACTION.CUSTOM_ID = CUSTOMER.CUSTOM_ID)
                   INNER JOIN PET ON TRANSACTION.PET_ID = PET.PET_ID    
                   INNER JOIN EMPLOYEE ON TRANSACTION.EMP_ID = EMPLOYEE.EMP_ID
                   Where TRANSACTION.STATUS=1 order by TRANSACTION.TRANSACTION_ID
poojavb 29 Junior Poster

I have created a project for clinic in vb.net...

So I have one exe file for it....

But I want VBnet installer and Crystalreport runtime installer to be packaged along with it...

As to when the user will click the exe file the VB.Net installer shud first install then the crystal report and finally the application shud start --- scenario for the first time installation

Later the application shud start with the exe file only and not with the VB.Net or crystal report installer since it will already be installed in the machine....

Can u please tell me how should I package these installation together....

poojavb 29 Junior Poster

if your prob is solved then please mark this thread solved :)
Regards

Ya sure....thank u....

poojavb 29 Junior Poster

try this may be this will helps you

If reader.Read = True Then
dim a as integer
 a = val(reader.read).tostring()
if a <> null then 
   Debug.Print("True")
endif
    
    Else
       Debug.Print("False")
    End If

this is just an idea , so please check it by your self .

Regards

I used formatting for datetimepicker....my issue has been solved...

poojavb 29 Junior Poster

hello !
please check the following link , hope this will will solve your prob :)
http://www.sdn.sap.com/irj/boc/support?rid=/webcontent/uuid/d01fdad8-44e5-2d10-61ad-9d2d4158f3a8

Regards

The zip file is not opening....

When the download box comes and I save the file...its takes a lot of time and finally in between the download completes and the zip file does not open....

I tried downloading in many machines....

poojavb 29 Junior Poster

Hello,

Can any one provide me with the Crsytal report runtime installer for Visual Studio 2010..

I have the installer of Visual Studio 2008 but its of no use...

I need the installer that is the .msi file....

Can anyone provide it to me...coz I have searched a lot....

poojavb 29 Junior Poster

and please try this query , may be this will solve your prob .

"select sum(tmt.total) as Total from Appointment appt inner join  TreatmentMaster tmt on  [tmt].[treatid]=[appt].[treatmentid] where appt.patientid='" + txtPatIDBill.Text + "' and [appt.ApptDate] between '" + dtpFromBill.Value.Date.tostring() + "' and  '" + dtpToBill.Value.Date.tostring() + "'"

I tried this also using

Debug.Print("Date: " + dtpToBill.Value.Date.ToString)

If I use the to String method then I will also get the time along with the date
Date: 2/24/2012 12:00:00 AM

poojavb 29 Junior Poster

and please try this query , may be this will solve your prob .

"select sum(tmt.total) as Total from Appointment appt inner join  TreatmentMaster tmt on  [tmt].[treatid]=[appt].[treatmentid] where appt.patientid='" + txtPatIDBill.Text + "' and [appt.ApptDate] between '" + dtpFromBill.Value.Date.tostring() + "' and  '" + dtpToBill.Value.Date.tostring() + "'"

I got the answer...but I need help on how to proceed....

Actually when I take some other date that is not there in database the 'sum(tmt.total) as Total ' returns a null value and therefore the reader takes it as true...

but if I remove the sum and just write '(tmt.total) as Total' then no records are retrieved and it returns false that is correct...but I need the sum for calculation....

so I need to know how shud I proceed....

poojavb 29 Junior Poster

Do you need () on the Read()?
http://msdn.microsoft.com/en-us/library/haa3afyz.aspx#Y608

no the () are not necessary....i have tried with it also...

poojavb 29 Junior Poster

Hello Friends,

I am messed up with the below query

Try
    Dim myCommand As OleDbCommand
    myCommand = New OleDbCommand("select sum(tmt.total) as Total from Appointment appt, TreatmentMaster tmt where appt.patientid='" + txtPatIDBill.Text + "' and [tmt].[treatid]=[appt].[treatmentid] and (Format([appt.ApptDate], 'Short Date')) between '" + dtpFromBill.Value.Date + "' and  '" + dtpToBill.Value.Date + "'", Connection)
    Dim reader As OleDbDataReader = myCommand.ExecuteReader
    Debug.Print("Query output: " + myCommand.CommandText)
    If reader.Read = True Then
       Debug.Print("True")
    Else
       Debug.Print("False")
    End If
Catch ex As Exception
    MsgBox("Error Connecting to Database: " & ex.Message)
End Try

I have to select the patientid, from date and the to date from the GUI part....

I have values in Database for date 2/20/2012 and 2/22/2012

whenever I try to run the query in Access it is returning the correct data...

but when i run the query in my project the reader in not reading correctly...even if values are present is returns false
and if values are not there then it returns true....

I am not getting where I am going wrong...
Please help me...

poojavb 29 Junior Poster

Go to the project properties under that u could see Publish click on it. u could see button called Prereqisites click on it. u can choose the framework from there and see other options as well.

Thank u very much......

poojavb 29 Junior Poster

I have understood ur problem. It was my suggetion to have published setup files server to so its easy to maintain. However u can add the framework in Prerequisites. So it will check for the framework version and installs.

I have never done this thing....

Can u please tell me how to proceed with it...
Can u also tell me how to publish the application....it will be a favor for me...plzzzz