LENDO ARQUIVO SQL 2000
Ola Pessoal eu tenho essa conecao abaixo:
Mycon.Open [Ô]Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sjinfo;Initial Catalog=Contabil;Data Source=CARLOS-BA815594[Ô]
MyTable.Open [Ô]Bancos[Ô], Mycon, adOpenStatic, adLockOptimistic, adCmdTableDirect
quando eu vou ler a tabela da um erro de: Provedor atual nao oferece suporte para interfacer a funcionabilde de indice
MyTable.Index = [Ô]Primary[Ô]
MyTable.Seek vreg
If MyTable.EOF Then
MsgBox [Ô]ELEMENTO DE DESPESA NAO CADASTRADO[Ô]
Else
Tcodigo = IIf(MyTable(1) <> [Ô][Ô], MyTable(1), 0)
end if
para o SQL 2000 a leitura e diferente.
Se algume puder me ajudar e agradeço
Obrigado..
Mycon.Open [Ô]Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sjinfo;Initial Catalog=Contabil;Data Source=CARLOS-BA815594[Ô]
MyTable.Open [Ô]Bancos[Ô], Mycon, adOpenStatic, adLockOptimistic, adCmdTableDirect
quando eu vou ler a tabela da um erro de: Provedor atual nao oferece suporte para interfacer a funcionabilde de indice
MyTable.Index = [Ô]Primary[Ô]
MyTable.Seek vreg
If MyTable.EOF Then
MsgBox [Ô]ELEMENTO DE DESPESA NAO CADASTRADO[Ô]
Else
Tcodigo = IIf(MyTable(1) <> [Ô][Ô], MyTable(1), 0)
end if
para o SQL 2000 a leitura e diferente.
Se algume puder me ajudar e agradeço
Obrigado..
porque não usa comando SQL?
e qual seria os comandos do SQL?
Depende...
o que você está querendo fazer?
o que você está querendo fazer?
estou querendo ler os dados de arquivo e mostrar na tela, e depois alterar e gravar ou incluir um novo registro
olhe um exemplo ai
MyTable2.Index = [Ô]Codigo[Ô]
vctl = 0
If MyTable2.BOF = False Then
MyTable2.MoveFirst
Do Until MyTable2.EOF [ô] Do While MyTable5.NoMatch
If MyTable2(1) = vexercicio Then
If Trim(MyTable2(3)) <> [Ô][Ô] Then
Cnumlei.List(vctl) = IIf(MyTable2(3) <> [Ô][Ô], MyTable2(3), [Ô] [Ô])
vctl = vctl + 1
End If
End If
MyTable2.MoveNext
Loop
End If
MyTable2.Index = [Ô]Codigo[Ô]
vctl = 0
If MyTable2.BOF = False Then
MyTable2.MoveFirst
Do Until MyTable2.EOF [ô] Do While MyTable5.NoMatch
If MyTable2(1) = vexercicio Then
If Trim(MyTable2(3)) <> [Ô][Ô] Then
Cnumlei.List(vctl) = IIf(MyTable2(3) <> [Ô][Ô], MyTable2(3), [Ô] [Ô])
vctl = vctl + 1
End If
End If
MyTable2.MoveNext
Loop
End If
+/- isso:
dim rs_0 as adodb.recordset
dim v_sql as string
v_sql=[Ô]select campo1 from tabela where campo=criterio[Ô]
set rs_0=Mycon.execute v_sql
do while not rs_0.eof
debug.print rs_0!campo1
rs_0.movenext
loop
dim rs_0 as adodb.recordset
dim v_sql as string
v_sql=[Ô]select campo1 from tabela where campo=criterio[Ô]
set rs_0=Mycon.execute v_sql
do while not rs_0.eof
debug.print rs_0!campo1
rs_0.movenext
loop
e se eu quizer ler aum registro na tabela pelo indice [Ô]Codigo[Ô] outra Chave
como faço?
como faço?
utilize o order by para ordenar
e os indices são gerenciados pelo sqlserver
e os indices são gerenciados pelo sqlserver
Eu sei amigo, mais o que eu quero e saber como faço pra ler um registro na tabela, usando uma chave criada
o exemplo abaixo mostra como ler um registro
Set MyTable = Mycon.Execute([Ô]Select * From bancos where id = [Ô] + Str(vreg))
If MyTable.EOF Then
MsgBox [Ô]ELEMENTO DE DESPESA NAO CADASTRADO[Ô]
Else
Tcodigo = IIf(MyTable(1) <> [Ô][Ô], MyTable(1), 0)
Tcodigoct = IIf(MyTable(12) <> [Ô][Ô], MyTable(12), [Ô] [Ô])
Tbanco = IIf(MyTable(2) <> [Ô][Ô], MyTable(2), [Ô] [Ô])
end if
mais o que eu queria saber e que tenho uma chave na minha tabela e quero usar-la
como seria os comandos.
o exemplo abaixo mostra como ler um registro
Set MyTable = Mycon.Execute([Ô]Select * From bancos where id = [Ô] + Str(vreg))
If MyTable.EOF Then
MsgBox [Ô]ELEMENTO DE DESPESA NAO CADASTRADO[Ô]
Else
Tcodigo = IIf(MyTable(1) <> [Ô][Ô], MyTable(1), 0)
Tcodigoct = IIf(MyTable(12) <> [Ô][Ô], MyTable(12), [Ô] [Ô])
Tbanco = IIf(MyTable(2) <> [Ô][Ô], MyTable(2), [Ô] [Ô])
end if
mais o que eu queria saber e que tenho uma chave na minha tabela e quero usar-la
como seria os comandos.
Então voce poderá utilizar o Table Hint
através dos table hints podemos especificar que Ãndice queremos que o query do Sql Server utilize para uma determinada query, utilizando a cláusula index.
ex.: select * from tabela with (index=nome_do_indice)
para mais detalhes pesquise sobre o table hint no book online do sqlserver
através dos table hints podemos especificar que Ãndice queremos que o query do Sql Server utilize para uma determinada query, utilizando a cláusula index.
ex.: select * from tabela with (index=nome_do_indice)
para mais detalhes pesquise sobre o table hint no book online do sqlserver
Tópico encerrado , respostas não são mais permitidas