AnaGPSI Posted May 14, 2012 at 02:52 PM Report #455427 Posted May 14, 2012 at 02:52 PM Olá boa tarde alguém me poderia ajudar? Quando executo o meu programa aparece uma mensagem no ExecuteNonQuery a dizer que a capacidade foi excedida o que será?
migueldesousa Posted May 14, 2012 at 02:53 PM Report #455429 Posted May 14, 2012 at 02:53 PM capacidade ?? consegues mostrar a mensagem de erro ??? áááá caralhassssssss
AnaGPSI Posted May 14, 2012 at 02:59 PM Author Report #455436 Posted May 14, 2012 at 02:59 PM Não consigo publicar aqui a imagem
migueldesousa Posted May 14, 2012 at 03:02 PM Report #455440 Posted May 14, 2012 at 03:02 PM copia do debug ou assim áááá caralhassssssss
AnaGPSI Posted May 14, 2012 at 03:06 PM Author Report #455445 Posted May 14, 2012 at 03:06 PM Não consigo! LoOl 😕
migueldesousa Posted May 14, 2012 at 03:13 PM Report #455449 Posted May 14, 2012 at 03:13 PM epa 🙂 dificil assim n é do tempo de execução?? áááá caralhassssssss
Tuntankamon Posted May 15, 2012 at 08:50 AM Report #455660 Posted May 15, 2012 at 08:50 AM Tenta aumentar o tempo de timeout da conexão, tal como o miugeldesousa disse e verifica o que acontece.
AnaGPSI Posted May 15, 2012 at 08:57 AM Author Report #455663 Posted May 15, 2012 at 08:57 AM Aumentar o tempo de execução como assim? Como?
jpaulino Posted May 15, 2012 at 09:27 AM Report #455670 Posted May 15, 2012 at 09:27 AM Tens de mostrar o código!
Tuntankamon Posted May 15, 2012 at 10:31 AM Report #455682 Posted May 15, 2012 at 10:31 AM Sem dúvida que o código ajudava... Mas de qualquer modo para aumentares o timeout, podes adicionar mais uma propriedade à conexão, com o valor de timeout. MSDN
AnaGPSI Posted May 15, 2012 at 11:45 AM Author Report #455697 Posted May 15, 2012 at 11:45 AM (edited) O código é este: Dim connetionString As String Dim oledbCnn As OleDbConnection Dim oledbCmd As OleDbCommand Dim oledbCmd1 As OleDbCommand Dim cod_cur, cod_tur As Integer connetionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\GPSI\Documents\mydb.accdb;" Dim nome_disciplina = ComboBox3.SelectedItem Dim mydb As New OleDbConnection(connetionString) mydb.Open() Dim a, b, c, d, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, x, z, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, ll, mm, nn, oo, pp, qq, rr, ss, tt, uu, vv, aaa, bbb, ccc, eee, fff As String Dim sql, sql1, sql2, sql3, sql4 As String a = txtprocesso.Text b = txtnomealuno1.Text c = combosexo.Text d = Format(datatimenascialuno.Value, "dd-MM-yyyy") f = txtnacialuno.Text g = txtnomealuno2.Text h = txtemailaluno.Text i = txtmoradaluno.Text j = txtcodpostaluno1.Text k = txtcodpostaluno2.Text l = txtlocalidadealuo.Text m = txtconcnataluno.Text n = txtfregnataluno.Text o = txtpaisnataluno.Text p = txtdistriresialuno.Text q = txtconcresialuno.Text r = txtfregresialuno.Text s = combofami.Text t = txtmedicoaluno.Text u = Format(datatimevacina.Value, "dd-MM-yyyy") v = txtocorraluno.Text x = txtanotaluno.Text z = txtnomepai.Text aa = txtprofpai.Text bb = txtnomemae.Text cc = txtprofmae.Text dd = txttelepai.Text ee = txttelemae.Text ff = txtnatupai.Text gg = txtnatumae.Text hh = comboemppai.Text ii = comboempmae.Text jj = comboformpai.Text kk = comboformmae.Text ll = txtnomeEE.Text mm = txtmoradaEE.Text nn = txtcodpostEE1.Text oo = txtcodpostEE2.Text pp = txtlocaliEE.Text qq = ComboBox1.Text rr = txtteleEE.Text ss = txtnatEE.Text tt = txtprofEE.Text uu = comboempEE.Text vv = ComboBox2.Text aaa = txtbi.Text bbb = Format(databi.Value, "dd-MM-yyyy") ccc = TextBox3.Text eee = TextBox4.Text fff = TextBox2.Text sql1 = "select cod_curso from curso where nome ='" & ComboBox3.Text & "'" oledbCnn = New OleDbConnection(connetionString) Try oledbCnn.Open() oledbCmd = New OleDbCommand(sql1, oledbCnn) Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader() While oledbReader.Read cod_cur = oledbReader.Item(0) MsgBox(cod_cur) End While Finally End Try sql2 = "select cod_turma from turma where ano=10 and cod_curso like '%" & cod_cur & "%'" oledbCnn = New OleDbConnection(connetionString) Try oledbCnn.Open() oledbCmd1 = New OleDbCommand(sql2, oledbCnn) Dim oledbReader1 As OleDbDataReader = oledbCmd1.ExecuteReader() While oledbReader1.Read cod_tur = oledbReader1.Item(0) MsgBox(cod_tur) End While Finally End Try ''''''''''''''''''''' sql3 = "Insert Into encarregado_educacao ([nome_ee], [telefone_ee], [morada_ee], [profissao_ee], [escolaridade_ee], [naturalidade_ee], [empego_ee], [cod_postal_ee1], [cod_postal_ee2], [localidade_ee], [parentesco_ee]) values ('" & ll & "','" & rr & "','" & mm & "','" & tt & "','" & vv & "','" & ss & "','" & uu & "', '" & nn & "','" & oo & "','" & pp & "','" & qq & "')" Dim cmd1 As New OleDbCommand(sql3, mydb) cmd1.ExecuteNonQuery() '''''''''' Dim oledbCmda As OleDbCommand Dim sqla As String Dim cod_eee As Integer sqla = "SELECT Max (encarregado_educacao.cod_ee) FROM encarregado_educacao;" oledbCnn = New OleDbConnection(connetionString) oledbCnn.Open() oledbCmda = New OleDbCommand(sqla, oledbCnn) Dim oledbReadera As OleDbDataReader = oledbCmda.ExecuteReader() While oledbReadera.Read cod_eee = oledbReadera.Item(0) + 1 End While MsgBox(cod_eee) ''''''''''''''''''''''''''''''' sql4 = "Insert Into filiacao ([nome_pai], [nome_mae], [profissao_pai], [profissao_mae], [naturalidade_pai], [naturalidade_mae], [emprego_pai], [emprego_mae], [estudos_pai], [estudos_mae], [telefone_pai], [telefone_mae]) values ('" & z & "','" & bb & "','" & aa & "','" & cc & "', '" & ff & "','" & gg & "','" & hh & "','" & ii & "','" & jj & "','" & kk & "','" & dd & "','" & ee & "' )" Dim cmd2 As New OleDbCommand(sql4, mydb) cmd2.ExecuteNonQuery() '''''''''' Dim oledbCmdb As OleDbCommand Dim sqlb As String Dim cod_fil As Integer sqlb = "SELECT Max (filiacao.cod_filiacao) FROM filiacao;" oledbCnn = New OleDbConnection(connetionString) oledbCnn.Open() oledbCmdb = New OleDbCommand(sqlb, oledbCnn) Dim oledbReaderb As OleDbDataReader = oledbCmdb.ExecuteReader() While oledbReaderb.Read cod_fil = oledbReaderb.Item(0) + 1 End While MsgBox(cod_fil) ''''''''''''''''''''''''''''''' sql = "Insert Into aluno ([nome], [sexo], [data_nascimento], [bi], [validade_bi], [anotacoes], [morada], [cod_postal1], [cod_postal2], [telemovel], [ocorrencia], [n_medico], [vacinas], [n_ssocial], [nif], [agreg_familiar], [localidade], [email], [natufreguesia], [natuconcelho], [natupais], [residistrito], [resiconcelho], [resifreguesia], [cod_turma], [cod_ee], [cod_filiacao]) values ('" & b & "','" & c & "','" & d & "','" & aaa & "','" & bbb & "','" & x & "', '" & i & "','" & j & "','" & k & "', '" & fff & "','" & v & "', '" & t & "', '" & u & "', '" & ccc & "', '" & eee & "', '" & s & "', '" & l & "', '" & h & "', '" & n & "', '" & m & "','" & o & "', '" & p & "', '" & q & "', '" & r & "', '" & cod_tur & "', '" & cod_eee & "', '" & cod_fil & "')" Dim cmd As New OleDbCommand(sql, mydb) cmd.ExecuteNonQuery() MsgBox("Aluno Introduzido!") End Sub Edited May 15, 2012 at 12:32 PM by Caça GeSHi
Caça Posted May 15, 2012 at 12:55 PM Report #455715 Posted May 15, 2012 at 12:55 PM Em que linha é que dá o erro? Pedro Martins Não respondo a duvidas por PM
AnaGPSI Posted May 15, 2012 at 01:29 PM Author Report #455722 Posted May 15, 2012 at 01:29 PM (edited) Neste cmd: cmd1.ExecuteNonQuery() Diz capacidade excedida! sql3 = "Insert Into encarregado_educacao ([nome_ee], [telefone_ee], [morada_ee], [profissao_ee], [escolaridade_ee], [naturalidade_ee], [empego_ee], [cod_postal_ee1], [cod_postal_ee2], [localidade_ee], [parentesco_ee]) values ('" & ll & "','" & rr & "','" & mm & "','" & tt & "','" & vv & "','" & ss & "','" & uu & "', '" & nn & "','" & oo & "','" & pp & "','" & qq & "')" Dim cmd1 As New OleDbCommand(sql3, mydb) cmd1.ExecuteNonQuery() Edited May 16, 2012 at 10:11 AM by jpaulino Bloco código
AnaGPSI Posted May 16, 2012 at 10:01 AM Author Report #455990 Posted May 16, 2012 at 10:01 AM Já me consegui resolver obrigada pela disponibilidade. 😉
migueldesousa Posted May 16, 2012 at 11:26 AM Report #456021 Posted May 16, 2012 at 11:26 AM então o que fizeste ? áááá caralhassssssss
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