Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8267975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:43:18+00:00 2026-06-08T05:43:18+00:00

I am new in vb.net, sql and even record data in phpmyadmin. When I

  • 0

I am new in vb.net, sql and even record data in phpmyadmin. When I add the records using my interface, I checked my phpmyadmin and it was indicating to have an entry in the table meaning my vb.net and phpmyadmin is connected but the values returned NULL. How can I make it not NULL? instead ,records the desired data?

This is my code:

Dim ServerString As String = "Server=localhost; database=patientinfo;user id=root;password=" 
Dim SQLConnection As New MySqlConnection()

Public Sub SaveInfos(ByRef SQLStatement As String)
    Dim cmd As MySqlCommand = New MySqlCommand

    With cmd
        .CommandText = SQLStatement
        .CommandType = CommandType.Text
        .Connection = SQLConnection
        .ExecuteNonQuery()

    End With
    SQLConnection.Close()

    'MsgBox("Successfully Added!")
    MsgBox("Successfully Saved")
    Me.Visible = False
    Mainform.Show()

    SQLConnection.Dispose()
End Sub

 Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
    Try
        '===========================Add New Patient========================================
        bednumber = txtbednum.Text
        patient_name = txtName.Text
        patient_age = Convert.ToInt32(txtAge.Text)
        date_of_confinement = Date.Parse(dtpDate.Value)
        type_of_sickness = txtSickness.Text
        type_of_IV_fluid = txtFluid.Text
        number_of_bottles = Convert.ToInt32(txtBottle.Text)
        drop_rate = Convert.ToInt32(txtDrop.Text)

        'To check if all values have been filled up
        If patient_name = "" Or patient_age = "" Or date_of_confinement = "" _
        Or type_of_sickness = "" Or type_of_IV_fluid = "" Or number_of_bottles = "" Or drop_rate = "" _
        Then

            MsgBox("Please Complete All the Required Fields")

        Else

            Dim SQLStatement As String = "INSERT INTO patient(bednumber, name, age, date_of_confinement,type_of_sickness, type_of_IV_fluid, number_of_bottles, drop_rate) VALUES(@bednumber, @name, @age, @date_of_confinement, @type_of_sickness, @type_of_IV_fluid, @number_of_bottles, @drop_rate)"
            SaveInfos(SQLStatement)

This what my table looks like in phpmyadmin:

http://i1182.photobucket.com/albums/x454/catherinefbalauro/Untitled.png

Any help would be appreciated. Thanks! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:43:20+00:00Added an answer on June 8, 2026 at 5:43 am

    Do something like this:

    ' Assuming that your SQLStatement is as follow
    ' INSERT INTO MyTableName 
    ' VALUES (  @bednumber, @name, @age, 
    '           @date_of_confinement,@type_of_sickness,
    '           @type_of_IV_fluid, @number_Of_Bottles,
    '           @drop_rate
    '        )
    With cmd
        .CommandText = SQLStatement
        .CommandType = CommandType.Text
        .Connection = SQLConnection
    
        .Parameters.AddWithValue("@bednumber", txtbednum.Text)
        .Parameters.AddWithValue("@name", txtName.Text)
        .Parameters.AddWithValue("@age", txtAge.Text)
        ' dothe same until
        ' you have added allthe parameter
        ' with values
    
        SQLConnection.Open()
        .ExecuteNonQuery()
    End With
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server database and I'm using ADO.NET ExecuteReader to get a
I am currently using Visual Studio 2008 (VB.Net) and SQL Server 2008. I have
We have a .NET e-commerce application with a SQL Server 2005 back-end. A new
In my .net application, I have used LINQ-to-SQL to get some data from the
I'm new at LINQ, searching the net for LINQ samples that mimic SQL's LIKE
In WebSphere message Broker 8, the new .NET compute node is awesome to interface
I am new to .Net. I have two objects, Customer and Country in my
I have a new asp.net mvc project and i am trying to figure out
Using SQL Membership Provider for ASP.NET membership. I'm using first.last as the username, which
I am fairly new to .NET C# development and recently started using LINQ to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.