Naveed_786 25 Posting Whiz in Training

No body has any idea please help

Naveed_786 25 Posting Whiz in Training

It is not working on the click event of button

"Variable Inst2.Visible = True is nor memeber of Payment System"

Also i am unable to understand the folowing line of code.

rpt_datewisePolicy_display1
Naveed_786 25 Posting Whiz in Training

By using this code we are inserting image into a folder but not in database. How can we save picture in Sql Server Database.

PictureBox1.Image.Save(Environment.CurrentDirectory & "\images\" & nametextbox.text)Dim Conn As SqlClient.SqlConnectionDim Cmd As SqlClient.SqlCommandDim DR As SqlClient.SqlDataReaderDim ConnStr As String = "PUT YOU CONNECTION STRING"Dim SQL As String = "Insert into TABLENAME(COLUMNNAME) Values("@1")"SQL = SQL.Replace("@1" , Environment.CurrentDirectory & "\images\" & nametextbox.text)Conn = New SqlClient.SqlConnection(ConnStr)Conn.Open()Cmd = New SqlClient.SqlCommand(SQL, Conn)Cmd.ExecuteNonQueryMsgbox("Saved!")PictureBox1.Image.Save(Environment.CurrentDirectory & "\images\" & nametextbox.text)
Dim Conn As SqlClient.SqlConnection
Dim Cmd As SqlClient.SqlCommand
Dim DR As SqlClient.SqlDataReader
Dim ConnStr As String = "PUT YOU CONNECTION STRING"
Dim SQL As String = "Insert into TABLENAME(COLUMNNAME) Values("@1")"
SQL = SQL.Replace("@1" , Environment.CurrentDirectory & "\images\" & nametextbox.text)
Conn = New SqlClient.SqlConnection(ConnStr)
Conn.Open()
Cmd = New SqlClient.SqlCommand(SQL, Conn)
Cmd.ExecuteNonQuery
Msgbox("Saved!")
Naveed_786 25 Posting Whiz in Training

Dear All,

How can i get Crystal report between two dates from SQL SERVER Database.

We will enter the dates from One column.

Any help will be apriciated.

Naveed_786 25 Posting Whiz in Training

Now it gives error Name IsAdminUser is not declared.

Naveed_786 25 Posting Whiz in Training

Here is my code it gives me error "IsAdminuser is not member of PMS"
what should i do now to resolve this problem.

Module GlobalStuff  

Public Function IsLoggedIn(ByVal PassUserName As String, ByVal PassPassword As String) As Boolean  
Dim ReturnBool As Boolean = True        
Dim cnString As String = "Data Source=ITS;Initial Catalog=Payment;Integrated Security=True"         
Dim conn As SqlConnection = New SqlConnection(cnString)     
Dim sql = "SELECT Username,Pass,IsAdmin FROM Login WHERE Username = '" & PassUserName & "' AND Pass = '" & PassPassword & "'" 
Dim cmd As SqlCommand = New SqlCommand(sql, conn)  
Try  
conn.Open()  
Dim dr As SqlDataReader = cmd.ExecuteReader  
'ReturnBool = dr.Read()  
' since the select statement is going to return a value that   
' we want to read we will go ahead and read it in 
If dr.Read() Then  
GlobalStuff.IsAdminUser = Convert.ToBoolean(dr("IsAdmin").ToString())  
Else  
GlobalStuff.IsAdminUser = False  
ReturnBool = False  
End If     
Catch Exp As SqlException  
ReturnBool = False  
'Put other code to handle, log, etc... errors here  
Catch Exp As Exception  
ReturnBool = False  
'Put other code to handle, log, etc... errors here  
Finally  
If conn IsNot Nothing AndAlso conn.State <> ConnectionState.Closed Then  
conn.Close()  
End If            
End Try  
Return ReturnBool  
End Function  
End Module
Naveed_786 25 Posting Whiz in Training

Thanks it resolved my problem.

Naveed_786 25 Posting Whiz in Training

I am using date and time picker to get current date but when i get date from date and time picker first time it gives me current date and time i save the record and when i try to get date and time second time without unloading the form it does not work please help me.

DateTimePicker1.Text = DateTime.Now.ToString()  

TextBox12.Text = DateTimePicker1.Value.ToString()
Naveed_786 25 Posting Whiz in Training

Dear It is specifically for one image how can i load multiple image in picture box.

Naveed_786 25 Posting Whiz in Training

i want to load image in picturebox then store it in sql server 2008

Naveed_786 25 Posting Whiz in Training

No body has any idea about pictures in vb.net

Naveed_786 25 Posting Whiz in Training

Thanks for you reply i have already resolved the problem was not this.

Naveed_786 25 Posting Whiz in Training

How to store and retrieve images from VB.NET and Sql Server 2008

Naveed_786 25 Posting Whiz in Training

Sorry i didn't understand you please provide me example

Naveed_786 25 Posting Whiz in Training

Thanks its woking but now it replaces form name how can i display both the form name and date and time.

Please please help thanks for your kind support and help.

Naveed_786 25 Posting Whiz in Training

where should i write this line of code to get date and time on top of the form?

Naveed_786 25 Posting Whiz in Training

I want to display date and time on top of the form where normlly written form1 forms name

i want to display date in formate of for example 23 August 2010

and time in this formate 12:33:20AM

Please please help.

Naveed_786 25 Posting Whiz in Training

i am getting error on (required) is not declared.

YourTextBox.AutoCompleteCustomSource.Add(YourDataSet.Tables("Table").Rows(i).Item(Required)
Naveed_786 25 Posting Whiz in Training

Actully i want to auto complete or sugesseted from database.

Naveed_786 25 Posting Whiz in Training

Hi guys,

I want to search a customer when i press an alphabet 'a' it should search and show drop down list of all customer those name start with 'a'.

Please please help thanks in advance.

Naveed_786 25 Posting Whiz in Training

Can i make privilages to make two modes

1. Admin Mode
2. Ristricted User Mode.

Please give me some sample code.

I am using vb.net with sql server 2008.

Naveed_786 25 Posting Whiz in Training

I am using the following code to delete record it did not delete record but just only populate message record deleted successfully what should i do now please please help me.

If TextBox1.Text = "" Then
            MessageBox.Show("Please Select record to delete......", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If
        If MessageBox.Show("Do you really want to Delete this Record?", _
                "ALI ENTERPRISES", MessageBoxButtons.YesNo, _
                MessageBoxIcon.Warning) = DialogResult.Yes Then
            MessageBox.Show("Record Deleted Successfully......", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""
            TextBox5.Text = ""
        Else
            Exit Sub
        End If
        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        Try
            con.ConnectionString = "Data Source=ITS;Initial Catalog=Payment;Integrated Security=True"
            con.Open()
            cmd.Connection = con

            cmd.CommandText = "DELETE FROM CustomerInformation WHERE CustomerID ='" & Trim(TextBox4.Text) & "'"
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show("Error while Deleting record From table..." & ex.Message, "Delete Records")
        Finally
            If con.State = ConnectionState.Open Then

                con.Close()

            End If
        End Try
Naveed_786 25 Posting Whiz in Training
Dim con As SqlConnection = New SqlConnection(strCon)

After replacing it gives same error

Naveed_786 25 Posting Whiz in Training

Hi guys,

I am using this code to update a record after searching but it gives me error here is my code please please help

Dim con As New SqlClient.SqlConnection
        Dim strCon As String = "Data Source=ITS;Initial Catalog=Payment;Integrated Security=True"


        Dim strCommand As String = "SELECT * FROM CustomerInformation WHERE CustomerID = '" & TextBox4.Text & "'"

        'Create connection
        Dim conn As SqlConnection = New SqlConnection(strCon)

        Try
            con.ConnectionString = strCon

            Dim cm As New SqlClient.SqlCommand(strCommand, con)

            con.Open()
            Dim da As SqlDataAdapter = New SqlDataAdapter(strCommand, con)
            'create dataset
            Dim ds As DataSet = New DataSet
            'fill dataset
            da.Fill(ds, "CustomerInformation")
            'get data table
            Dim dt As DataTable = ds.Tables("CustomerInformation")

            With dt
                .Rows(0)("CustomerName") = TextBox1.Text
                .Rows(0)("FName") = TextBox2.Text
                .Rows(0)("IdCardNo") = TextBox3.Text
                .Rows(0)("CustomerID") = TextBox4.Text
                .Rows(0)("Address") = TextBox5.Text
            End With

            'update customers table
            da.Update(ds, "CustomerInformation")
            MessageBox.Show("Record Updated Successfully......", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MsgBox("Error: " & ex.ToString & vbCrLf)
        Finally
            If con.State = ConnectionState.Open Then

                con.Close()
            End If
        End Try
    End Sub
Naveed_786 25 Posting Whiz in Training

No body has any idea?

Naveed_786 25 Posting Whiz in Training

Hi guys,

Can anyone help me how can i search,delete,undo edit record in vb.net using sql server2008 as database please please give me some sample code thanks in advance.

Naveed_786 25 Posting Whiz in Training

Dear,

i have already provided you link for my post i am again sending you link for my thread please please help me to resolve it.

http://www.daniweb.com/forums/thread303147.html

Naveed_786 25 Posting Whiz in Training

You should make all textboxes as required by you then select that textbox whose color you want to chenge then in properties change its color.

I hope it would help.

Naveed_786 25 Posting Whiz in Training

You should write

Dialoge1.Show()

instead of

Dialoge.Show()
Naveed_786 25 Posting Whiz in Training

Problem is in your code at Dim dialog As New Dialog1 and you are calling dialoge.show() this wrong you should call

dialog.Show()
Naveed_786 25 Posting Whiz in Training

you can do this open your project then click on first tab then click on view from menu bar then click on tab oder here you can set the tab oder of all controles placed on form

Naveed_786 25 Posting Whiz in Training

you must add this code on form load event of splach screen form

me.close()
form1.show()
Naveed_786 25 Posting Whiz in Training

I have tried it but not working i have put the code on leave event it is working.

Naveed_786 25 Posting Whiz in Training

I have saved customer name in single column and iam using ms access database.

Naveed_786 25 Posting Whiz in Training

It gives me following error "Customerfound errorinfo.getdescription failed with E_Fail(0x80004005) please help.

Naveed_786 25 Posting Whiz in Training

Hi dear,

I want to pass two dates from crystal report and want to get result between these two dates but it returns result only from one date here is my code any suggestion:

If TextBox1.Text = "" Or TextBox2.Text = "" Then
            MessageBox.Show("Please enter Date!", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If
        TextBox1.Visible = False
        TextBox2.Visible = False
        Button1.Visible = False
        Dim cryRpt As New ReportDocument
        cryRpt.Load(Application.StartupPath & "\Inst2.rpt")
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue
        Dim crParameterDiscreteValue1 As New ParameterDiscreteValue
        crParameterDiscreteValue.Value = TextBox1.Text
        crParameterDiscreteValue1.Value = TextBox2.Text
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
        crParameterFieldDefinition = _
        crParameterFieldDefinitions.Item("PaymentDate")
        crParameterValues = crParameterFieldDefinition.CurrentValues

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

        Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
        Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

        For Each tbCurrent In cryRpt.Database.Tables
            tliCurrent = tbCurrent.LogOnInfo
            With tliCurrent.ConnectionInfo
                .ServerName = Application.StartupPath & "\Payment.mdb"
                .UserID = ""
                .Password = ""
                .DatabaseName = Application.StartupPath & "\Payment.mdb"
            End With
            tbCurrent.ApplyLogOnInfo(tliCurrent)
        Next tbCurrent

        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()

and

{instalment.PaymentDate } = {?PaymentDate}
Naveed_786 25 Posting Whiz in Training

Hi all,

I am trying to check a record in database before inerting a new record here is my code but problem is when i enter a names first alphabet it imediatly populate massage please help me i want to check it after entering whole name thanks in advance.

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Try
            Dim cnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\Payment.mdb;"
            Dim sqlQRY As String = "SELECT COUNT(*) AS numRows FROM CustomerInformation WHERE CustomerName = '" & TextBox1.Text & "'"
            Dim queryResult As Integer
            Dim conn As OleDbConnection = New OleDbConnection(cnString)
            conn.Open()
            Dim com As New OleDbCommand(sqlQRY, conn)
            queryResult = com.ExecuteScalar()
            conn.Close()
            If queryResult > 0 Then
                MessageBox.Show("Already Exists!", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
                TextBox1.Text = ""
                Exit Sub
            End If
        Catch ex As Exception
            MessageBox.Show("Customer found" + ex.Message)
        End Try
    End Sub
Naveed_786 25 Posting Whiz in Training

Dear All,

I am designing a crystal report in VB.NET

I have designed a crystal report i want to pass parameter from a textbox but when i pass parameter or without passing parameter run the report it pulls all the records from the database please help my code is as follows:

With Form12
            If TextBox9.Text = "" Then
                MsgBox("Please select a product to print.", MsgBoxStyle.Critical)

                Exit Sub
                .strReport = "Filter"
                .strWhere = "{PlotNo.Hiring} = """ & TextBox9.Text & """"
            End If
            Form12.ShowDialog()
        End With
Public strWhere As String
    Public strReport As String
    Private mReport As ReportDocument
    Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim pvCollection As New CrystalDecisions.Shared.ParameterValues
        Dim pdvBusName As New CrystalDecisions.Shared.ParameterDiscreteValue
        Dim pdvBusAddress As New CrystalDecisions.Shared.ParameterDiscreteValue
        Dim pdvContactInfo As New CrystalDecisions.Shared.ParameterDiscreteValue
        mReport = New ReportDocument()
        Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
        Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

        mReport.Load(Application.StartupPath & "\HIR.rpt")

        mReport.RecordSelectionFormula = strWhere

        For Each tbCurrent In mReport.Database.Tables
            tliCurrent = tbCurrent.LogOnInfo
            With tliCurrent.ConnectionInfo
                .ServerName = Application.StartupPath & "\Payment.mdb"
                .UserID = ""
                .Password = ""
                .DatabaseName = Application.StartupPath & "\Payment.mdb"
            End With
            tbCurrent.ApplyLogOnInfo(tliCurrent)
        Next tbCurrent

        CrystalReportViewer1.ReportSource = mReport
Naveed_786 25 Posting Whiz in Training

Hi all,

Can some one tell me why my crystal reports asks for user name and password at run time when i install then from setup please please help me.

Thnaks in advance.

Naveed_786 25 Posting Whiz in Training

No body has idea about it please help me

Naveed_786 25 Posting Whiz in Training

Dear All,

When i make Setup of my project then my crystal report asks for user Name and password but i didnot create user or password for my database in access i think it didnot find the path what should i do.

when i entered the data in the table data inserted in the table but when i try to run report it asks for user name and password but when i make a folder with the same path which i have give in the report then report takes data from old database but newly inserted record are not displaed.

Naveed_786 25 Posting Whiz in Training

Dear All,

When i make Setup of my project then my crystal reports keeps old database path how can i resolve it please help me.

Naveed_786 25 Posting Whiz in Training

Thanks it working

Naveed_786 25 Posting Whiz in Training

i have try this but its giving me same error what should i do now?

Naveed_786 25 Posting Whiz in Training

its not woking same eorror occured again.

Naveed_786 25 Posting Whiz in Training

Yes reports are in same folder then how to use application.startuppath

Naveed_786 25 Posting Whiz in Training

yes error comes on line no 8 ok can i use this code here "Application.StartupPath"

Naveed_786 25 Posting Whiz in Training

Ok now the problem is with report when i run it throws exception load report error i am using this code:

If TextBox1.Text = "" Then
            MessageBox.Show("Please enter PlotNo!", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If
        TextBox1.Visible = False
        Button1.Visible = False
        Dim cryRpt As New ReportDocument
        cryRpt.Load("D:\PaymentSystem\PaymentSystem\Hir.rpt")
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        crParameterDiscreteValue.Value = TextBox1.Text
        'crParameterDiscreteValue.Value = TextBox2.Text
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
        crParameterFieldDefinition = _
        crParameterFieldDefinitions.Item("PlotNo")
        crParameterValues = crParameterFieldDefinition.CurrentValues

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

        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    End Sub

What should i do to resolve this problem please help me.

Naveed_786 25 Posting Whiz in Training

Actually i am using this connecting string

Dim cnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\Payment.mdb;"
Naveed_786 25 Posting Whiz in Training

Dear All,

I have a problem i have made setup of my project when i install it and run the program it asks for the complete path of database like this "C:\Paymentsystem\PaymentSystem\bin\Debug"

is there any way i want to change the path i mean i want to place database in d drive please help.