dcsimg
Results 1 to 8 of 8

Thread: error database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    75

    error database

    I;m getting this error i don't know why but my project should create about 100 table per day using same pc

    Name:  fffwwww.jpg
Views: 271
Size:  15.8 KB

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,425

    Re: error database

    Hi Yehya,

    You obviously don't have privileges for that on the SQL database. Are you the DB admin? If so then search for something like "GRANT PRIVILEGES".
    Handy References:
    MSDN Library
    ADO Tutorial Excel Tutorial MZTools (VB6)

    • Please pull down the Thread Tools menu and click the 'Mark Thread Resolved' button, or alternately edit your original post and add "Resolved" or place a in the subject when your question(s) have been answered.
    • Please use code tags [highlight=vb] your code goes here between the tags [/highlight] when posting code.

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,425

    Re: error database

    Also, you should consider closing the objCon 'before' the dialog code block to prevent keeping the connection open until a user has acknowledged it.

    To go one better, you should have error handling around that commit. Present a dialog if successful, and one if not (and roll back changes as need be).
    Last edited by Bruce Fox; Sep 16th, 2018 at 12:13 AM.
    Handy References:
    MSDN Library
    ADO Tutorial Excel Tutorial MZTools (VB6)

    • Please pull down the Thread Tools menu and click the 'Mark Thread Resolved' button, or alternately edit your original post and add "Resolved" or place a in the subject when your question(s) have been answered.
    • Please use code tags [highlight=vb] your code goes here between the tags [/highlight] when posting code.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    75

    Re: error database

    hello dear i'm the admin of my databases but i don't know what to do how can i solve this problem i don't have any idea please could you help me with the codes this is mine

    Code:
            Dim conStr As String = "Server=;UserId=;Password=;"
            Dim objCon As New MySqlConnection(conStr)
            Dim obj As MySqlCommand
            Dim strSQL As String
    
            objCon.Open()
            obj = objCon.CreateCommand()
            strSQL = "CREATE TABLE sql291853." & TextBox5.Text & "(" & _
              "id INTEGER NOT NULL primary key AUTO_INCREMENT ," & _
              "type  VARCHAR(30), " & _
              "Time VARCHAR(20), " & _
              "Date VARCHAR(30), " & _
              "Time VARCHAR(50), " & _
              "Price VARCHAR(50), " & _
              "Admin VARCHAR(50) " & _
              ") "
    
            obj.CommandText = strSQL
            obj.ExecuteNonQuery()
            If (MessageBox.Show("Your Account Has Been Created,Thanks", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) = DialogResult.OK) Then
                Me.Close()
            End If
            objCon.Close()

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    75

    Re: error database

    thanks a lot i solve it <3

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: error database

    It's not a code issue. It's a database configuration issue. You need to configure the database so that the user connecting has permission to create tables on that database you were specifically told this in post #2:
    If so then search for something like "GRANT PRIVILEGES".
    Have you done that? It's not really accurate to say that you don't have any idea because you were provided with an idea but you just ignored it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,425

    Re: error database

    Tehya,

    Is this 'really' what you are doing: "my project should create about 100 table per day using same pc"
    Or, do you just want to create a series of 'records' each day in a given table?
    Handy References:
    MSDN Library
    ADO Tutorial Excel Tutorial MZTools (VB6)

    • Please pull down the Thread Tools menu and click the 'Mark Thread Resolved' button, or alternately edit your original post and add "Resolved" or place a in the subject when your question(s) have been answered.
    • Please use code tags [highlight=vb] your code goes here between the tags [/highlight] when posting code.

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,118

    Re: error database

    Indeed... If the tables have the same fields, there should almost certainly only be only one table, with one extra field that contains the same information as the table names you are currently using (though possibly indirectly, using a lookup table).

    You can then use a Where clause on your SQL statements to limit the rows to only the ones appropriate to your current "table name".


    The increase in storage size will be negligible, and the speed is likely to be near enough the same... but most of the code will be much much simpler, and there will be far less management of tables (eg: the routine you showed does not even need to exist).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width