jcbiker Posted September 19, 2012 at 04:04 PM Report #475901 Posted September 19, 2012 at 04:04 PM (edited) Boas estou a utilizar este modelo para sql Using context As New viatEntities Dim efect As New Viaturas With { .Matricula = txtMat.Text, .Local= cboxlocal.Text, .marca = mar, .km = txtKmAd.Text, .Ano = txtAnoAd.Text, .Data = ano, .combust = cboxComb.Text, .GalpFrota = "-", .Destino = "-", .inop = "Não" } context.Viaturas.AddObject(efect) context.SaveChanges() End Using e pretendia utilizalo para acess 2007 Using context As New RegProc1DataSet Dim adc As New TipoProc With { .nome = txtNovoTC.Text } context.TipoProc.AddObject(efect) context.SaveChanges() End Using mas não funciona alguem me pode ajudar?? Edited September 19, 2012 at 04:28 PM by Caça GeSHi
Caça Posted September 19, 2012 at 04:28 PM Report #475903 Posted September 19, 2012 at 04:28 PM O EntityFramework não é compatível com Access. Pedro Martins Não respondo a duvidas por PM
jcbiker Posted September 20, 2012 at 08:52 AM Author Report #475964 Posted September 20, 2012 at 08:52 AM (edited) Ok. Mas então tenho um problema. Com este código sql = "INSERT INTO TiposProc([Nome]) VALUES (@Nome)" Dim command As New OleDbCommand(sql, cn) command.Parameters.Add("@Nome", OleDbType.WChar).Value = txtNovoTC.Text ' Actualiza apenas os dados do cliente que consta na Textbox cn.Open() command.ExecuteScalar() MessageBox.Show("Actualizado com sucesso!", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Information) txtNovoTC.Text = "" carregaTipoProc(cboxTProc, cboxTProc) pnCrime.Visible = False cboxTProc.Focus() cn.Close() command = Nothing Não grava nada na base. Ou seja este código coore e combobox carrega com os dados que mandei adicionar. Mas, se fechar a aplicação e voltar a iniciar, a combobox já não carrega valor nenhum. Qundo vou abrir a base esta tb não tem valor nenhum. Já experimentei com " Dim x as integer = command.ExecuteNonQuery()" Edited September 20, 2012 at 10:18 AM by Caça
Solution jcbiker Posted September 20, 2012 at 09:11 AM Author Solution Report #475969 Posted September 20, 2012 at 09:11 AM Resolvido. O problema estava na conecção.
bioshock Posted September 20, 2012 at 06:06 PM Report #476013 Posted September 20, 2012 at 06:06 PM Futuros problemas: https://wiki.portugal-a-programar.pt/dev_net/vb.net/access/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now