By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

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

P: 5
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=localhost;username=root;password=;data base=xyz;charset=utf8;"
Oct 9 '12 #1
Share this Question
Share on Google+
1 Reply


P: 5
HERE IS MY VB.NET CODE:

Expand|Select|Wrap|Line Numbers
  1. Imports MySql.Data.MySqlClient
  2.  
  3.  
  4. Public Class Spider_Prompt
  5.  
  6.     Dim conn As Common.DbConnection
  7.     Dim da As Common.DbDataAdapter
  8.     Dim ds As DataSet = New DataSet
  9.     Dim cnString As String
  10.     Dim query_rundown As String
  11.     Dim query_tblrundownnames As String
  12.     'Dim dt As DataTable
  13.  
  14.  
  15.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  16.  
  17.         '''''DATE AND TIME
  18.         Label11.Text = Now.ToString("D")
  19.         Label12.Text = Now.ToString("T")
  20.         '''''DATE AND TIME
  21.         'Call ConnectDatabase()
  22.  
  23.  
  24.         '''''''' SECOND GRID FOR GETTING ID OF MOS ACTIVE, BUT SHOULD PRINT ON LABELS
  25.  
  26.         cnString = "datasource=localhost;username=root;password=;database=spidernews;charset=utf8;"
  27.         query_tblrundownnames = "Select id,mosactive,rundown_names,rundown_time from tblrundownnames where mosactive = 'ONAIR'"
  28.         conn = New MySqlConnection(cnString)
  29.  
  30.         Try
  31.             conn.Open()
  32.             da = New MySqlDataAdapter(query_tblrundownnames, conn)
  33.             Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
  34.             da.Fill(ds, "tblrundownnames a tblcurrentrundown b")
  35.             DataGridView2.DataSource = ds
  36.             DataGridView2.DataMember = "tblrundownnames a tblcurrentrundown b"
  37.  
  38.             Dim i, j As Integer
  39.             lbl_R_archiveid.Text = DataGridView2.Item(0, i).Value
  40.             lbl_R_Heading.Text = DataGridView2.Item(2, i).Value
  41.             lbl_R_Status.Text = DataGridView2.Item(1, i).Value
  42.  
  43.         Catch ex As Common.DbException
  44.             MsgBox(ex.ToString)
  45.         Finally
  46.             conn.Close()
  47.         End Try
  48.  
  49.         '''''''' SECOND GRID FOR GETTING ID OF MOS ACTIVE, BUT SHOULD PRINT ON LABELS
  50.  
  51.         '''''Data Grid 1: FOR tblcurrentrundown
  52.         cnString = "datasource=localhost;username=root;password=;database=spidernews;Character Set=utf8"
  53.         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"
  54.         conn = New MySqlConnection(cnString)
  55.  
  56.         Try
  57.             conn.Open()
  58.             da = New MySqlDataAdapter(query_rundown, conn)
  59.             Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
  60.             da.Fill(ds, "tblcurrentrundown")
  61.             DataGridView1.DataSource = ds
  62.             DataGridView1.DataMember = "tblcurrentrundown"
  63.  
  64.             'DataGridView1.Columns(2).Visible = False
  65.             DataGridView1.Columns(6).Visible = False
  66.             DataGridView1.Columns(7).Visible = False
  67.             DataGridView1.Columns(8).Visible = False
  68.  
  69.         Catch ex As Common.DbException
  70.             MsgBox(ex.ToString)
  71.         Finally
  72.             conn.Close()
  73.         End Try
  74.  
  75.         '''''''' TEXT BOX READING URDU TEXT FILE COMPOSE FROM UrduNigarUnicode
  76.  
  77.         Dim FILE_NAME As String = "D:\VB.NET-WIN-PLUS\01-DEMO-PROMPTER\UrduNigarUnicode.txt"
  78.         Dim TextLine As String
  79.         If System.IO.File.Exists(FILE_NAME) = True Then
  80.  
  81.             Dim objReader As New System.IO.StreamReader(FILE_NAME)
  82.  
  83.             Do While objReader.Peek() <> -1
  84.                 TextLine = TextLine & objReader.ReadLine() & vbNewLine
  85.             Loop
  86.             RichTextBox2.Text = TextLine
  87.         Else
  88.             MsgBox("File Does Not Exist")
  89.         End If
  90.  
  91.     End Sub
  92.  
  93.     Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
  94.  
  95.         'RichTextBox1.Text = DataGridView1.CurrentCell.Value
  96.         'Prompter.RichTextBox1.Text = DataGridView1.CurrentCell.Value
  97.         Dim i, j As Integer
  98.         i = DataGridView1.CurrentRow.Index
  99.  
  100.         RichTextBox1.Text = DataGridView1.Item(1, i).Value
  101.         Prompter.RichTextBox1.Text = DataGridView1.Item(1, i).Value
  102.  
  103.     End Sub
  104.  
  105.  
  106.  
  107.     Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
  108.  
  109.         Prompter.Show()
  110.  
  111.     End Sub
  112.  
  113.     Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
  114.  
  115.         Controller.Show()
  116.  
  117.     End Sub
  118.  
  119.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  120.  
  121.         'Me.Refresh()
  122.         DataGridView1.Refresh()
  123.  
  124.     End Sub
  125.  
  126.     Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
  127.  
  128.         'Me.Refresh()
  129.         DataGridView1.Refresh()
  130.  
  131.     End Sub
  132.  
  133.     Private Sub Button_NEXT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_NEXT.Click
  134.  
  135.         Dim i, j As Integer
  136.         i = DataGridView1.CurrentRow.Index
  137.  
  138.         Dim lastRowNum As Integer = (Me.DataGridView1.Rows.Count - 1 - 1)
  139.         Dim curDataGridViewRow As DataGridViewRow = DataGridView1.CurrentRow
  140.         Dim curRowNum As Integer = curDataGridViewRow.Index
  141.         If (curRowNum >= lastRowNum) Then
  142.  
  143.             MsgBox("RUN DWON END -- BUR NOT SELECT THE LAST ROW")
  144.  
  145.         Else
  146.  
  147.             Dim nextRow As DataGridViewRow = DataGridView1.Rows(curRowNum + 1)
  148.             DataGridView1.CurrentCell = nextRow.Cells(0)
  149.             nextRow.Selected = True
  150.  
  151.             RichTextBox1.Text = DataGridView1.Item(0, i).Value
  152.  
  153.         End If
  154.  
  155.     End Sub
  156.  
  157.     Private Sub Button_Previous_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Previous.Click
  158.  
  159.         Dim i, j As Integer
  160.         i = DataGridView1.CurrentRow.Index
  161.  
  162.         Dim lastRowNum As Integer = (Me.DataGridView1.Rows.Count + 1 + 1)
  163.         Dim curDataGridViewRow As DataGridViewRow = DataGridView1.CurrentRow
  164.         Dim curRowNum As Integer = curDataGridViewRow.Index
  165.         If (curRowNum >= lastRowNum) Then
  166.  
  167.             MsgBox("ERROR: ON FIRST ROW SELECTED")
  168.  
  169.         Else
  170.  
  171.             Dim nextRow As DataGridViewRow = DataGridView1.Rows(curRowNum - 1)
  172.             DataGridView1.CurrentCell = nextRow.Cells(0)
  173.             nextRow.Selected = True
  174.  
  175.             RichTextBox1.Text = DataGridView1.Item(0, i).Value
  176.  
  177.         End If
  178.     End Sub
  179.  
  180.  
  181. End Class
Oct 9 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.