none
Visual Basic Dot Net - putting math equations in richtextbox in vb.net

    Question

  • I have a table in sqlserver called  "myequations" having following fields 

    serial number

    equation name

    equation

    I want to know how to insert records (equations) from vb.net to sqlserver?

    is it possible?

    Sunday, April 9, 2017 7:53 AM

All replies

  • Its just a SQL Table with three fields.  The "equation" is nothing but a string.  This would just be a typical database update.  You can follow any example of using VB.Net with a database.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Sunday, April 9, 2017 1:38 PM
    Moderator
  • Hello Sir

    i want to store the equations like  ( in microsoft word - insert -> equations)   in sql table through vb.net form and also want to show the same in vb form

    thanks in advance

    Monday, April 10, 2017 9:16 AM
  • i want to store the equations like  ( in microsoft word - insert -> equations)   in sql table through vb.net form and also want to show the same in vb form

    How you display the equations is not the same as how you store them.  If the equations are represented using a special font (eg, in a rich text box), then the data to be stored is probably a string of characters.  But there are many other ways of describing an equation, and if you are using a specialised mathematical expression display procedure then it is possible that the equations are stored using a language specific to that procedure. For instance, are you representing the equations like expressions in VB, where names are used for functions and there are only a few operators, or are you using a proper mathematical language, that would include forms such as integrals, superscripts and subscripts?   So the answer to you question is going to depend on how your equations are represented internally within the application.   

    If you want to find out how MSWord stores an expression then you would be best to ask in a WORD forum.

    Monday, April 10, 2017 10:33 AM
  • Hi Sukuta,

    Based on your description, you want to insert data from vb.net to sqlserver, the code below you can refer to.

    Dim con As New SqlConnection
    Dim cmd As New SqlCommand
    Try
    con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
    con.Open()
    cmd.Connection = con
    cmd.CommandText = "INSERT INTO table([field1], [field2]) VALUES([Value1], [Value2])"
    cmd.ExecuteNonQuery()
    
    Catch ex As Exception
    MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
    Finally
    con.Close()
    End Try
    

    Hope it is helpful to you.

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 11, 2017 3:30 AM
    Moderator