Click here to Skip to main content
15,904,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need your help in,
I am working on a project, MYSQL and PHP based,
with WAMP SERVER
I have a field storytext, (data collected in URDU language UTF-8) detail are:


Field Type Collation Null Default
storytext text utf8_unicode_ci Yes NULL

Retrieving URDU Data from MY SQL 5.5.8 running on wamp server with PHP is OK,

And the soft ware is only for Internal use not web base!
------------------------------------------------------------------------------------------------------------------------
HERE IS THE PROBLEM:

One section of it is designed on Visual Studio.NET 2010 in which

I have a datagrid, on clicking any row I got the TEXT in details on text box,

which show URDU TEXT, from data base here is the problem bind with DATA GRID and TEXT BOX.

I got this..........

DESP. ITEM

پروگرام رانا مب
شر ايٹ پرائم ٹائم ميں
گ٠تگو کرتے Û ÙˆØ¦Û’ وزير٠اعظم Ú©Û’
وکيل Ú†ÙˆÛ Ø¯Ø±ÙŠ اعتزاز احسن
کا Ú©Û Ù†Ø§ تھا Ú©Û ØµØ¯Ø± Ú©Û’ Ø¹Û Ø¯Û’
Ú©Ùˆ استشني حاصل Û Û’
وزير٠اعظم Ø
------------------------------------------------------------------------------------------------------------------------
IT SHOULD BE LIKE THIS:


پروگرام رانا مبشر ايٹ پرائم ٹائم ميں گفتگو کرتے ہوئے وزيرِ اعظم کے وکيل چوہدري اعتزاز احسن کا کہنا تھا کہ صدر کے عہدے کو استشني حاصل ہے وزيرِ اعظم جيل سے بھي وزارتِ عظمي چلاسکتے ہيں۔


------------------------------------------------------------------------------------------------------------------------

I also use in visual studio

cnString = "datasource=localhost;username=root;password=;database=xyz;charset=utf8;"

VB
Imports MySql.Data.MySqlClient


Public Class Spider_Prompt

    Dim conn As Common.DbConnection
    Dim da As Common.DbDataAdapter
    Dim ds As DataSet = New DataSet
    Dim cnString As String
    Dim query_rundown As String
    Dim query_tblrundownnames As String
    'Dim dt As DataTable


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '''''DATE AND TIME
        Label11.Text = Now.ToString("D")
        Label12.Text = Now.ToString("T")
        '''''DATE AND TIME
        'Call ConnectDatabase()


        '''''''' SECOND GRID FOR GETTING ID OF MOS ACTIVE, BUT SHOULD PRINT ON LABELS

        cnString = "datasource=localhost;username=root;password=;database=spidernews;charset=utf8;"
        query_tblrundownnames = "Select id,mosactive,rundown_names,rundown_time from tblrundownnames where mosactive = 'ONAIR'"
        conn = New MySqlConnection(cnString)

        Try
            conn.Open()
            da = New MySqlDataAdapter(query_tblrundownnames, conn)
            Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
            da.Fill(ds, "tblrundownnames a tblcurrentrundown b")
            DataGridView2.DataSource = ds
            DataGridView2.DataMember = "tblrundownnames a tblcurrentrundown b"

            Dim i, j As Integer
            lbl_R_archiveid.Text = DataGridView2.Item(0, i).Value
            lbl_R_Heading.Text = DataGridView2.Item(2, i).Value
            lbl_R_Status.Text = DataGridView2.Item(1, i).Value

        Catch ex As Common.DbException
            MsgBox(ex.ToString)
        Finally
            conn.Close()
        End Try

        '''''''' SECOND GRID FOR GETTING ID OF MOS ACTIVE, BUT SHOULD PRINT ON LABELS

        '''''Data Grid 1: FOR tblcurrentrundown
        cnString = "datasource=localhost;username=root;password=;database=spidernews;Character Set=utf8"
        query_rundown = "SET NAMES UTF8; SET CHARACTER SET UTF8;Select newstitle,newstext,listorder,newsid,newsduration,newstype,archiveid,newsoption,storyfloat from tblcurrentrundown where archiveid= '" & lbl_R_archiveid.Text & "' order by listorder"
        conn = New MySqlConnection(cnString)

        Try
            conn.Open()
            da = New MySqlDataAdapter(query_rundown, conn)
            Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
            da.Fill(ds, "tblcurrentrundown")
            DataGridView1.DataSource = ds
            DataGridView1.DataMember = "tblcurrentrundown"

            'DataGridView1.Columns(2).Visible = False
            DataGridView1.Columns(6).Visible = False
            DataGridView1.Columns(7).Visible = False
            DataGridView1.Columns(8).Visible = False

        Catch ex As Common.DbException
            MsgBox(ex.ToString)
        Finally
            conn.Close()
        End Try

        '''''''' TEXT BOX READING URDU TEXT FILE COMPOSE FROM UrduNigarUnicode

        Dim FILE_NAME As String = "D:\VB.NET-WIN-PLUS\01-DEMO-PROMPTER\UrduNigarUnicode.txt"
        Dim TextLine As String
        If System.IO.File.Exists(FILE_NAME) = True Then

            Dim objReader As New System.IO.StreamReader(FILE_NAME)

            Do While objReader.Peek() <> -1
                TextLine = TextLine & objReader.ReadLine() & vbNewLine
            Loop
            RichTextBox2.Text = TextLine
        Else
            MsgBox("File Does Not Exist")
        End If

    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

        'RichTextBox1.Text = DataGridView1.CurrentCell.Value
        'Prompter.RichTextBox1.Text = DataGridView1.CurrentCell.Value
        Dim i, j As Integer
        i = DataGridView1.CurrentRow.Index

        RichTextBox1.Text = DataGridView1.Item(1, i).Value
        Prompter.RichTextBox1.Text = DataGridView1.Item(1, i).Value

    End Sub



    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

        Prompter.Show()

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        Controller.Show()

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        'Me.Refresh()
        DataGridView1.Refresh()

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        'Me.Refresh()
        DataGridView1.Refresh()

    End Sub

    Private Sub Button_NEXT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_NEXT.Click

        Dim i, j As Integer
        i = DataGridView1.CurrentRow.Index

        Dim lastRowNum As Integer = (Me.DataGridView1.Rows.Count - 1 - 1)
        Dim curDataGridViewRow As DataGridViewRow = DataGridView1.CurrentRow
        Dim curRowNum As Integer = curDataGridViewRow.Index
        If (curRowNum >= lastRowNum) Then

            MsgBox("RUN DWON END -- BUR NOT SELECT THE LAST ROW")

        Else

            Dim nextRow As DataGridViewRow = DataGridView1.Rows(curRowNum + 1)
            DataGridView1.CurrentCell = nextRow.Cells(0)
            nextRow.Selected = True

            RichTextBox1.Text = DataGridView1.Item(0, i).Value

        End If

    End Sub

    Private Sub Button_Previous_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Previous.Click

        Dim i, j As Integer
        i = DataGridView1.CurrentRow.Index

        Dim lastRowNum As Integer = (Me.DataGridView1.Rows.Count + 1 + 1)
        Dim curDataGridViewRow As DataGridViewRow = DataGridView1.CurrentRow
        Dim curRowNum As Integer = curDataGridViewRow.Index
        If (curRowNum >= lastRowNum) Then

            MsgBox("ERROR: ON FIRST ROW SELECTED")

        Else

            Dim nextRow As DataGridViewRow = DataGridView1.Rows(curRowNum - 1)
            DataGridView1.CurrentCell = nextRow.Cells(0)
            nextRow.Selected = True

            RichTextBox1.Text = DataGridView1.Item(0, i).Value

        End If
    End Sub

   
End Class
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900