Click here to Skip to main content
15,917,005 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalvisual basic 2010 homework Pin
Member 1052356014-Jan-14 5:10
Member 1052356014-Jan-14 5:10 
GeneralRe: visual basic 2010 homework Pin
Ron Beyer14-Jan-14 5:15
professionalRon Beyer14-Jan-14 5:15 
GeneralRe: visual basic 2010 homework Pin
Member 1052356014-Jan-14 5:21
Member 1052356014-Jan-14 5:21 
GeneralRe: visual basic 2010 homework Pin
Tim Carmichael14-Jan-14 5:44
Tim Carmichael14-Jan-14 5:44 
GeneralRe: visual basic 2010 homework Pin
Member 1052356014-Jan-14 5:47
Member 1052356014-Jan-14 5:47 
GeneralRe: visual basic 2010 homework Pin
Pete O'Hanlon14-Jan-14 6:17
mvePete O'Hanlon14-Jan-14 6:17 
GeneralRe: visual basic 2010 homework Pin
Member 1052356014-Jan-14 14:10
Member 1052356014-Jan-14 14:10 
GeneralRe: visual basic 2010 homework Pin
Pete O'Hanlon14-Jan-14 19:01
mvePete O'Hanlon14-Jan-14 19:01 
QuestionInteracting with Excel: version problem or distribution problem Pin
Steven St. John9-Jan-14 5:14
Steven St. John9-Jan-14 5:14 
AnswerRe: Interacting with Excel: version problem or distribution problem Pin
TnTinMn9-Jan-14 16:07
TnTinMn9-Jan-14 16:07 
GeneralRe: Interacting with Excel: version problem or distribution problem Pin
Steven St. John10-Jan-14 4:32
Steven St. John10-Jan-14 4:32 
GeneralRe: Interacting with Excel: version problem or distribution problem Pin
TnTinMn10-Jan-14 8:58
TnTinMn10-Jan-14 8:58 
GeneralRe: Interacting with Excel: version problem or distribution problem Pin
Steven St. John10-Jan-14 9:53
Steven St. John10-Jan-14 9:53 
AnswerRe: Interacting with Excel: version problem or distribution problem Pin
Steven St. John14-Jan-14 10:31
Steven St. John14-Jan-14 10:31 
Questionfile Downloader Help Pin
Member 105110268-Jan-14 2:15
Member 105110268-Jan-14 2:15 
AnswerRe: file Downloader Help Pin
Dave Kreskowiak8-Jan-14 3:10
mveDave Kreskowiak8-Jan-14 3:10 
QuestionAnchor Pin
Tsunamipudip8-Jan-14 2:13
Tsunamipudip8-Jan-14 2:13 
AnswerRe: Anchor Pin
Dave Kreskowiak8-Jan-14 3:04
mveDave Kreskowiak8-Jan-14 3:04 
QuestionTrouble with IF...Then...ElseIf... Pin
big_D7-Jan-14 11:36
big_D7-Jan-14 11:36 
AnswerRe: Trouble with IF...Then...ElseIf... Pin
Bernhard Hiller7-Jan-14 20:49
Bernhard Hiller7-Jan-14 20:49 
GeneralRe: Trouble with IF...Then...ElseIf... Pin
big_D8-Jan-14 7:43
big_D8-Jan-14 7:43 
AnswerRe: Trouble with IF...Then...ElseIf... Pin
GuyThiebaut7-Jan-14 21:54
professionalGuyThiebaut7-Jan-14 21:54 
GeneralRe: Trouble with IF...Then...ElseIf... Pin
big_D8-Jan-14 7:44
big_D8-Jan-14 7:44 
QuestionDatagridView not display any data Pin
Biplob Singha Shee6-Jan-14 7:41
Biplob Singha Shee6-Jan-14 7:41 
Hi all,

My MySQL table structure is ...
(I am giving you from SQL Query)
SQL
DROP TABLE IF EXISTS `expenditure`;
CREATE TABLE IF NOT EXISTS `expenditure` (
  `ExpId` int(11) NOT NULL AUTO_INCREMENT,
  `ExpDate` date DEFAULT NULL,
  `ExpPurpose` varchar(350) DEFAULT NULL,
  `ExpRefNo` varchar(50) DEFAULT NULL,
  `Expenditure` double(10,2) DEFAULT '0.00',
  `ExpFlag` char(10) DEFAULT NULL,
  PRIMARY KEY (`ExpId`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `expenditure`
--

/*!40000 ALTER TABLE `expenditure` DISABLE KEYS */;
INSERT INTO `expenditure` (`ExpId`,`ExpDate`,`ExpPurpose`,`ExpRefNo`,`Expenditure`,`ExpFlag`) VALUES
(1,'2014-01-06','Purchase','ttyu76',15750,'P');
/*!40000 ALTER TABLE `expenditure` ENABLE KEYS */;

My Code is...
VB
Private Sub Generate()
        Dim DateFrom As Date = Convert.ToDateTime(DtpFrom.Value).ToString("yyyy-MM-dd")
        Dim DateTo As Date = Convert.ToDateTime(DtpTo.Value).ToString("yyyy-MM-dd")
        Try
            OpenConnection()
            Dim sb As New StringBuilder
            sb.Append("SELECT ExpDate,ExpPurpose,Expenditure FROM expenditure WHERE ExpDate BETWEEN '" & DateFrom & "' AND '" & DateTo & "'")
            Dim dbcommand As New MySqlCommand
            Dim dbadapter As New MySqlDataAdapter
            Dim stdata As New DataTable
            dbcommand.Connection = conn
            dbcommand.CommandText = sb.ToString
            dbadapter.SelectCommand = dbcommand
            dbadapter.Fill(stdata)
            DgvExp.DataSource = stdata  'DgvExp is the name of DataGridView

        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            CloseConnection()
        End Try
    End Sub

After the execution of the code, my Datagridview is not displaying any Data.

What is wrong ?
AnswerRe: DatagridView not display any data Pin
Dave Kreskowiak6-Jan-14 7:55
mveDave Kreskowiak6-Jan-14 7:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.