VB.net cannot Retrive Arabi or Urdu from MySql WAMP server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iqbalnazim
    New Member
    • Oct 2012
    • 5

    VB.net cannot Retrive Arabi or Urdu from MySql WAMP server

    I need your help, 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:storytext
    Type:text
    Collation:utf8_ unicode_ci (I tried all given collation in my phpadmin)
    Null:Yes
    Default: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 in TextBox,

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

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

    STORY TEXT:

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

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


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

    The Connector use for database in VB.NET:

    cnString = "datasource=loc alhost;username =root;password= ;database=xyz;c harset=utf8;"
    Last edited by iqbalnazim; Oct 9 '12, 09:22 PM. Reason: forget to add code
  • iqbalnazim
    New Member
    • Oct 2012
    • 5

    #2
    HERE IS MY VB.NET CODE:

    Code:
    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
    Last edited by Rabbit; Oct 9 '12, 09:37 PM. Reason: Please use code tags when posting code.

    Comment

    Working...