Jump to content
Xtreme .Net Talk

gaaz

Members
  • Posts

    11
  • Joined

  • Last visited

About gaaz

  • Birthday 03/28/1981

Personal Information

  • Occupation
    Network Admin
  • Visual Studio .NET Version
    Visual Studio .NET Professional
  • .NET Preferred Language
    VB.NET

gaaz's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Please could some1 help. I have a OleDbConnection, to an access database (jet4) OleDbCommand then than Inserts a record - which works. For each record a Autonumber primary key is created. Now what i want is for the newly created id to get brought back and showed on the form.? Heres my code to insert. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '----------------------------------------------- OleDbCommand1.Parameters("Name").Value = TextBox.Text '----------------------------------------------- Dim SQLreturn As Integer 'OPEN THE CONNECTION AND EXECUTE THE COMMAND Try OleDbConnection1.Open() SQLreturn = OleDbCommand1.ExecuteNonQuery() Catch ex As Exception MessageBox.Show(ex.Message) End Try 'END - SHOW EX MESSAGE IF NEED BE '----------------------------------------------- '----------------------------------------------- 'TEST IF STUFF WENT IN If SQLreturn <> 1 Then MessageBox.Show("Could not execute the INSERT query", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Else MessageBox.Show("Database Update Sucsesfull", "Confirm", MessageBoxButtons.OK, MessageBoxIcon.Information) End If OleDbConnection1.Close() 'END ME TEST - CLOSE THE CONNECTION '----------------------------------------------- End Sub
  2. Cheers Mate, Just played about and got it working - thank god for that! Again - Thank You Gaz
  3. cheers mate!! I will try - but if any1 can translate quicker than me please do?! here we go.
  4. Right. I paste that into VB.net but ahve a few complaints. I want my dattimepicker to be reset to what that code states. Or get that code to qwork in the first place. Im just not having any luck (been messing all day). Could some1 put it in vb.net and see fi hey can get it to work? or suggest? my head gone! lol. G
  5. err - the add.month is wrong - should be as you said add.days(-)
  6. cheers Please code you paste some sample code - im fairly new to this. Dim lastSatOfPrevious as DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(-1), DateTime.DaysInMonth(DateTime.Now.AddMonths(-1)) While (lastSatOfPrevious.DayOfWeek <> DayOfWeek.Saturday) lastSatOfPrevious.AddDays(-1) End While ^^ ive been given this -- but i dont understand it??
  7. Im selecting via a combo box a record, then selecting a date with it. Once this is done, im entering data into other fields, which all gets squirted to a table on an SQL server. This all works fine. I just want a check on Enter. in English. On Enter Does SQLtable already have a record containing (firstSelection & Date) if yes prompt user "Data from +date+ with +record+ already exists", would you like to.... Overwrite? Edit? Cancel? I guess it would be a if statement writing the buttonClicked. Any help would be great.
  8. Hi, Im using the DateTimePicker1. But when my form loads I want the date to be set to ..... Whatever date the last SATURDAY was. please could sum1 help!!
×
×
  • Create New...